Skip to main content

DynInbox

Struct DynInbox 

Source
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:

Implementations§

Source§

impl<T> DynInbox<T>

Source

pub fn new_unchecked(inbox: Arc<dyn DynPolyBox>) -> DynInbox<T>

Source

pub fn new<R>(inbox: R) -> DynInbox<T>
where R: DynPolyBox + PolyBox + 'static, T: SubsetOf<<R as PolyBox>::Set>,

Trait Implementations§

Source§

impl<T> Clone for DynInbox<T>

Source§

fn clone(&self) -> DynInbox<T>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T> DynPolyBox for DynInbox<T>

Source§

fn _send_boxed_payload_checked( &self, msg: BoxedPayload, ) -> Pin<Box<dyn Future<Output = Result<(), SendCheckedError<BoxedPayload>>> + Send + '_>>

Send a boxed payload.
Source§

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.
Source§

impl<T> PolyBox for DynInbox<T>
where T: Members,

Source§

type Set = T

The set of message types that this inbox can accept.
Source§

fn into_dyn_unchecked<R>(self) -> DynInbox<R>

Converts into a dynamic inbox without checking if the types are compatible. Read more
Source§

impl<T, R> Sends<T> for DynInbox<R>
where T: Message, <T as Message>::Kind: MessageSpecifier<T>, <<T as Message>::Kind as MessageSpecifier<T>>::Output: Send, <<T as Message>::Kind as MessageSpecifier<T>>::Payload: Send, R: Members + Contains<T>,

Source§

async fn send( &self, msg: T, ) -> Result<<<T as Message>::Kind as MessageSpecifier<T>>::Output, SendError<T>>

Sends a message of type T to the inbox.
Source§

fn send_blocking( &self, msg: T, ) -> Result<<<T as Message>::Kind as MessageSpecifier<T>>::Output, SendError<T>>

Same as Sends::send, 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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolyboxExt for T
where T: PolyBox,

Source§

fn into_dyn_subset<T>(self) -> DynInbox<T>
where T: SubsetOf<Self::Set>,

Converts into a dynamic inbox with a subset of the original types. Read more
Source§

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>(self) -> Result<DynInbox<T>, Self>
where T: Members,

Converts into a dynamic inbox, checking at runtime if the types are compatible.
Source§

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

Checks if the inbox accepts messages of the given types.
Source§

fn send_checked<T>( &self, msg: T, ) -> impl Future<Output = Result<<<T as Message>::Kind as MessageSpecifier<T>>::Output, SendCheckedError<T>>> + Send
where T: Message,

Send any message, checking at runtime if the message is accepted or not.
Source§

fn send_checked_blocking<T>( &self, msg: T, ) -> Result<<<T as Message>::Kind as MessageSpecifier<T>>::Output, SendCheckedError<T>>
where T: Message,

Same as Self::send_checked, but blocks the current thread until the message is sent.
Source§

impl<T, S> SendsExt<T> for S
where T: Message, S: Sends<T>,

Source§

fn request( &self, msg: T, ) -> impl Future<Output = Result<<<<T as Message>::Kind as MessageSpecifier<T>>::Output as MessageReply>::Reply, 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 more
Source§

fn request_blocking( &self, msg: T, ) -> Result<<<<T as Message>::Kind as MessageSpecifier<T>>::Output as MessageReply>::Reply, RequestError<T>>

Same as SendsExt::request, but blocks the current thread until the reply is received.
Source§

impl<T, S> SupersetOf<S> for T
where S: SubsetOf<T>,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<S> Zero for S
where S: ?Sized,