pub struct TypedIntoHandler<T: 'static>(pub Rc<dyn IntoHandler<T>>);Expand description
A shareable wrapper for ownership-based typed handlers.
This is the ownership-based equivalent of TypedHandler, used for
point-to-point messaging where the sender transfers ownership of the message.
§Thread Safety
Uses Rc intentionally (not Arc) for single-threaded use within each
async runtime. The MessageBus uses thread-local storage to ensure each
thread gets its own handlers.
Tuple Fields§
§0: Rc<dyn IntoHandler<T>>Implementations§
Source§impl<T: 'static> TypedIntoHandler<T>
impl<T: 'static> TypedIntoHandler<T>
Sourcepub fn new<H: IntoHandler<T>>(handler: H) -> Self
pub fn new<H: IntoHandler<T>>(handler: H) -> Self
Creates a new typed into handler from any type implementing IntoHandler<T>.
Sourcepub fn from<F>(callback: F) -> Selfwhere
F: Fn(T) + 'static,
pub fn from<F>(callback: F) -> Selfwhere
F: Fn(T) + 'static,
Creates a new typed into handler from a callback function.
Sourcepub fn from_with_id<S: AsRef<str>, F>(id: S, callback: F) -> Selfwhere
F: Fn(T) + 'static,
pub fn from_with_id<S: AsRef<str>, F>(id: S, callback: F) -> Selfwhere
F: Fn(T) + 'static,
Creates a new typed into handler from a callback function with a custom ID.
Trait Implementations§
Source§impl<T: 'static> Clone for TypedIntoHandler<T>
impl<T: 'static> Clone for TypedIntoHandler<T>
Source§impl<T: 'static> Debug for TypedIntoHandler<T>
impl<T: 'static> Debug for TypedIntoHandler<T>
impl<T: 'static> Eq for TypedIntoHandler<T>
Source§impl<T: 'static> Hash for TypedIntoHandler<T>
impl<T: 'static> Hash for TypedIntoHandler<T>
Auto Trait Implementations§
impl<T> !RefUnwindSafe for TypedIntoHandler<T>
impl<T> !Send for TypedIntoHandler<T>
impl<T> !Sync for TypedIntoHandler<T>
impl<T> !UnwindSafe for TypedIntoHandler<T>
impl<T> Freeze for TypedIntoHandler<T>
impl<T> Unpin for TypedIntoHandler<T>
impl<T> UnsafeUnpin for TypedIntoHandler<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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more