Function gcore::msg::send_init

source ·
pub fn send_init() -> Result<MessageHandle>
Expand description

Initialize a message to send formed in parts.

Gear allows programs to work with messages that consist of several parts. This function initializes a message built in parts and returns the corresponding MessageHandle.

§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 message in one step.
  • send_push, send_commit functions allows forming a message to send in parts.