pub struct IntoEndpointMap<T: 'static> { /* private fields */ }Expand description
Maps endpoints to ownership-based typed handlers for point-to-point messaging.
Unlike EndpointMap which borrows messages, this map transfers ownership
of messages to handlers, enabling zero-copy processing.
Implementations§
Source§impl<T: 'static> IntoEndpointMap<T>
impl<T: 'static> IntoEndpointMap<T>
Sourcepub fn is_registered(&self, endpoint: MStr<Endpoint>) -> bool
pub fn is_registered(&self, endpoint: MStr<Endpoint>) -> bool
Returns whether an endpoint is registered.
Sourcepub fn register(
&mut self,
endpoint: MStr<Endpoint>,
handler: TypedIntoHandler<T>,
)
pub fn register( &mut self, endpoint: MStr<Endpoint>, handler: TypedIntoHandler<T>, )
Registers a handler at an endpoint.
If the endpoint already has a handler, it will be replaced.
Sourcepub fn deregister(&mut self, endpoint: MStr<Endpoint>)
pub fn deregister(&mut self, endpoint: MStr<Endpoint>)
Deregisters the handler at an endpoint.
Sourcepub fn get(&self, endpoint: MStr<Endpoint>) -> Option<&TypedIntoHandler<T>>
pub fn get(&self, endpoint: MStr<Endpoint>) -> Option<&TypedIntoHandler<T>>
Gets the handler registered at an endpoint.
Sourcepub fn send(&self, endpoint: MStr<Endpoint>, message: T)
pub fn send(&self, endpoint: MStr<Endpoint>, message: T)
Sends a message to an endpoint, transferring ownership.
Logs an error if no handler is registered for the endpoint.
Trait Implementations§
Source§impl<T: Debug + 'static> Debug for IntoEndpointMap<T>
impl<T: Debug + 'static> Debug for IntoEndpointMap<T>
Auto Trait Implementations§
impl<T> !RefUnwindSafe for IntoEndpointMap<T>
impl<T> !Send for IntoEndpointMap<T>
impl<T> !Sync for IntoEndpointMap<T>
impl<T> !UnwindSafe for IntoEndpointMap<T>
impl<T> Freeze for IntoEndpointMap<T>
impl<T> Unpin for IntoEndpointMap<T>
impl<T> UnsafeUnpin for IntoEndpointMap<T>
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