pub struct Mailbox<M: Model>(_);
Expand description

A model mailbox.

A mailbox is an entity associated to a model instance that collects all messages sent to that model. The size of its internal buffer can be optionally specified at construction time using with_capacity.

Implementations§

source§

impl<M: Model> Mailbox<M>

source

pub const DEFAULT_CAPACITY: usize = 16usize

Default capacity when created with new or Default::default.

source

pub fn new() -> Self

Creates a new mailbox with capacity Self::DEFAULT_CAPACITY.

source

pub fn with_capacity(capacity: usize) -> Self

Creates a new mailbox with the specified capacity.

Panic

The constructor will panic if the requested capacity is 0 or is greater than usize::MAX/2 + 1.

source

pub fn address(&self) -> Address<M>

Returns a handle to this mailbox.

Trait Implementations§

source§

impl<M: Model> Debug for Mailbox<M>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<M: Model> Default for Mailbox<M>

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<M: Model> From<&Mailbox<M>> for Address<M>

source§

fn from(s: &Mailbox<M>) -> Address<M>

Converts a Mailbox reference into an Address.

This calls Mailbox::address() on the mailbox and returns the address.

Auto Trait Implementations§

§

impl<M> !RefUnwindSafe for Mailbox<M>

§

impl<M> Send for Mailbox<M>

§

impl<M> Sync for Mailbox<M>

§

impl<M> Unpin for Mailbox<M>

§

impl<M> !UnwindSafe for Mailbox<M>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. 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 Twhere 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, U> TryFrom<U> for Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.