Struct gcore::MessageHandle
source · pub struct MessageHandle(/* private fields */);
Expand description
Message handle.
Gear allows users and programs to interact with other users and programs via messages. Message creation consists of the following parts: message initialization, filling the message with payload (can be gradual), and message sending.
Here are the functions that make up the parts of forming and sending messages:
msg::send_init
initializes the messagemsg::send_push
adds a payload to a messagemsg::send_commit
sends a message
To identify a message that is being built from parts of a program, you
should use MessageHandle
obtained via
msg::send_init
.
§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(), 0).expect("Unable to send");
}
Trait Implementations§
source§impl Clone for MessageHandle
impl Clone for MessageHandle
source§fn clone(&self) -> MessageHandle
fn clone(&self) -> MessageHandle
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for MessageHandle
impl Debug for MessageHandle
source§impl PartialEq for MessageHandle
impl PartialEq for MessageHandle
source§fn eq(&self, other: &MessageHandle) -> bool
fn eq(&self, other: &MessageHandle) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl Copy for MessageHandle
impl Eq for MessageHandle
impl StructuralEq for MessageHandle
impl StructuralPartialEq for MessageHandle
Auto Trait Implementations§
impl RefUnwindSafe for MessageHandle
impl Send for MessageHandle
impl Sync for MessageHandle
impl Unpin for MessageHandle
impl UnwindSafe for MessageHandle
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more