Function gcore::msg::send_commit

source ·
pub fn send_commit(
    handle: MessageHandle,
    destination: ActorId,
    value: u128,
) -> Result<MessageId>
Expand description

Finalize and send the message formed in parts.

Gear allows programs to work with messages that consist of several parts. This function finalizes the message built in parts and sends it.

The first argument is the message handle MessageHandle that specifies a particular message built in parts. The second argument is the address of the target account. The third argument is the maximum gas allowed to be utilized during the message processing. Finally, the last argument is the value to be transferred from the current program account to the message target account.

§Examples

use gcore::msg;

#[no_mangle]
extern "C" fn handle() {
    let msg_handle = msg::send_init().expect("Unable to init");
    msg::send_push(msg_handle, b"Hello, ").expect("Unable to push");
    msg::send_push(msg_handle, b" world!").expect("Unable to push");
    msg::send_commit(msg_handle, msg::source(), 42).expect("Unable to commit");
}

§See also

  • send function allows sending a message in one step.
  • send_push, send_init functions allow forming a message to send in parts.