Function gcore::msg::send_push

source ·
pub fn send_push(handle: MessageHandle, payload: &[u8]) -> Result<()>
Expand description

Push a payload part of the message to be sent in parts.

Gear allows programs to work with messages in parts. This function adds a payload part to the message specified by the message handle.

The first argument is the message handle MessageHandle that specifies a particular message built in parts. The second argument is the payload buffer.

§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

  • reply_push function allows forming a reply message in parts.
  • send function allows sending a message in one step.
  • send_init, send_commit functions allows forming a message in parts and send it.