Struct rmp_ipc::context::Context [−][src]
pub struct Context { pub emitter: StreamEmitter, // some fields omitted }
Expand description
An object provided to each callback function. Currently it only holds the event emitter to emit response events in event callbacks.
use rmp_ipc::context::Context; use rmp_ipc::Event; use rmp_ipc::error::Result; async fn my_callback(ctx: &Context, _event: Event) -> Result<()> { // use the emitter on the context object to emit events // inside callbacks ctx.emitter.emit("ping", ()).await?; Ok(()) }
Fields
emitter: StreamEmitter
Expand description
The event emitter
Implementations
impl Context
[src]
impl Context
[src]pub async fn await_reply(&self, message_id: u64) -> Result<Event>
[src]
pub async fn await_reply(&self, message_id: u64) -> Result<Event>
[src]Waits for a reply to the given message ID
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Context
impl Send for Context
impl Sync for Context
impl Unpin for Context
impl !UnwindSafe for Context
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more