Function gstd::msg::send_input

source ·
pub fn send_input(
    program: ActorId,
    value: u128,
    range: impl RangeBounds<usize>,
) -> 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 argument is the index range that defines the input buffer’s piece to be sent to the target account.

§Examples

Send half of the incoming payload back to the sender.

use gstd::msg;

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

§See also