Function gcore::msg::send_input

source ·
pub fn send_input(
    destination: ActorId,
    value: u128,
    offset: u32,
    len: u32,
) -> Result<MessageId>
Expand description

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

The first argument is the address of the target account (ActorId). The second argument is the value to be transferred from the current program account to the message target account. The third and last arguments are the offset and length of the input buffer’s piece to be sent back.

§Examples

Send half of the incoming payload back to the sender.

use gcore::msg;

#[no_mangle]
extern "C" fn handle() {
    msg::send_input(msg::source(), 0, 0, msg::size() as u32 / 2).expect("Unable to send");
}

§See also

  • send_push_input function allows using the input buffer as a payload source for an outcoming message.