Function gstd::msg::reply_input

source ·
pub fn reply_input<Range: RangeBounds<usize>>(
    value: u128,
    range: Range
) -> Result<MessageId>
Expand description

Same as reply but uses the input buffer as a payload source.

The first argument is the value to be transferred from the current program account to the reply message target account. The second argument is the index range that defines the input buffer’s piece to be pushed back to the output.

§Examples

Send half of the incoming payload back to the sender as a reply.

use gstd::msg;

#[no_mangle]
extern "C" fn handle() {
    msg::reply_input(0, 0..msg::size() / 2).expect("Unable to reply");
}

§See also

  • super::reply_push_input function pushes a payload part to the current reply message using the input buffer as a payload source.
  • MessageHandle::push_input function allows using the input buffer as a payload source for an outcoming message.