pub struct DynInbox<T> { /* private fields */ }Expand description
A dynamic inbox that can accept messages of any type, as long as they are part of the specified set.
An inbox is typed as: DynInbox<Set![Msg1, Msg2, ...]>.
Conversions between inboxes:
- Into more specific subsets ->
PolyboxExt::into_dyn_subset. - Into more general supersets ->
PolyboxExt::into_dyn_checkedorPolyBox::into_dyn_unchecked.
Implementations§
Source§impl<T> DynInbox<T>
impl<T> DynInbox<T>
pub fn new_unchecked(inbox: Arc<dyn DynPolyBox>) -> Self
pub fn new<R>(inbox: R) -> Self
Trait Implementations§
Source§impl<T> DynPolyBox for DynInbox<T>
impl<T> DynPolyBox for DynInbox<T>
Source§fn _send_boxed_payload_checked(
&self,
msg: BoxedPayload,
) -> BoxFuture<'_, Result<(), SendCheckedError<BoxedPayload>>>
fn _send_boxed_payload_checked( &self, msg: BoxedPayload, ) -> BoxFuture<'_, Result<(), SendCheckedError<BoxedPayload>>>
Send a boxed payload.
Source§fn _send_boxed_payload_checked_blocking(
&self,
msg: BoxedPayload,
) -> Result<(), SendCheckedError<BoxedPayload>>
fn _send_boxed_payload_checked_blocking( &self, msg: BoxedPayload, ) -> Result<(), SendCheckedError<BoxedPayload>>
Same as
Self::_send_boxed_payload_checked, but blocks the current thread until the message is sent.Auto Trait Implementations§
impl<T> !RefUnwindSafe for DynInbox<T>
impl<T> !UnwindSafe for DynInbox<T>
impl<T> Freeze for DynInbox<T>
impl<T> Send for DynInbox<T>
impl<T> Sync for DynInbox<T>
impl<T> Unpin for DynInbox<T>
impl<T> UnsafeUnpin for DynInbox<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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> PolyboxExt for Twhere
T: PolyBox,
impl<T> PolyboxExt for Twhere
T: PolyBox,
Source§fn into_dyn_subset<T>(self) -> DynInbox<T>
fn into_dyn_subset<T>(self) -> DynInbox<T>
Converts into a dynamic inbox with a subset of the original types. Read more
Source§fn into_dyn(self) -> DynInbox<Self::Set>
fn into_dyn(self) -> DynInbox<Self::Set>
Converts into a dynamic inbox with the full set of original types.
Source§fn into_dyn_checked<T: Members>(self) -> Result<DynInbox<T>, Self>
fn into_dyn_checked<T: Members>(self) -> Result<DynInbox<T>, Self>
Converts into a dynamic inbox, checking at runtime if the types are compatible.
Source§fn accepts_msg(&self, id: TypeId) -> bool
fn accepts_msg(&self, id: TypeId) -> bool
Checks if the inbox accepts a message of the given type.
Source§fn accepts_msgs(&self, ids: &[TypeId]) -> bool
fn accepts_msgs(&self, ids: &[TypeId]) -> bool
Checks if the inbox accepts messages of the given types.
Source§fn send_checked<T: Message>(
&self,
msg: T,
) -> impl Future<Output = Result<Output<T>, SendCheckedError<T>>> + Send
fn send_checked<T: Message>( &self, msg: T, ) -> impl Future<Output = Result<Output<T>, SendCheckedError<T>>> + Send
Send any message, checking at runtime if the message is accepted or not.
Source§fn send_checked_blocking<T: Message>(
&self,
msg: T,
) -> Result<Output<T>, SendCheckedError<T>>
fn send_checked_blocking<T: Message>( &self, msg: T, ) -> Result<Output<T>, SendCheckedError<T>>
Same as
Self::send_checked, but blocks the current thread until the message is sent.Source§impl<T, S> SendsExt<T> for S
impl<T, S> SendsExt<T> for S
Source§fn request(
&self,
msg: T,
) -> impl Future<Output = Result<Reply<T>, RequestError<T>>> + Send + '_
fn request( &self, msg: T, ) -> impl Future<Output = Result<Reply<T>, RequestError<T>>> + Send + '_
Sends a message of type
T to the inbox and waits for a reply, if the message type has a reply type. Read moreSource§fn request_blocking(&self, msg: T) -> Result<Reply<T>, RequestError<T>>
fn request_blocking(&self, msg: T) -> Result<Reply<T>, RequestError<T>>
Same as
SendsExt::request, but blocks the current thread until the reply is received.