pub struct MailboxConfig { /* private fields */ }Expand description
Memory + overflow contract for every mailbox spawned by a crate::Runtime.
Fields are private so an out-of-range capacity or byte budget cannot
sneak in. Construct with MailboxConfig::new or
MailboxConfig::DEFAULT, then narrow the byte budget with
MailboxConfig::with_bytes.
Both bounds apply; the first one reached refuses the hop. See
super::MailboxBytes for why the hop count alone is not a memory
bound.
Implementations§
Source§impl MailboxConfig
impl MailboxConfig
Sourcepub const DEFAULT: MailboxConfig
pub const DEFAULT: MailboxConfig
Compile-time-valid default: 256 hops, 4 MiB, reject on overflow.
Sourcepub const fn new(capacity: MailboxCapacity, overflow: OverflowPolicy) -> Self
pub const fn new(capacity: MailboxCapacity, overflow: OverflowPolicy) -> Self
Capacity + policy, with the default byte budget.
The byte budget is a separate builder step rather than a third parameter so embedders that only care about hop count are not forced to reason about bytes to keep compiling.
Sourcepub const fn with_bytes(self, bytes: MailboxBytes) -> Self
pub const fn with_bytes(self, bytes: MailboxBytes) -> Self
Replace the byte budget.
pub const fn capacity(&self) -> MailboxCapacity
pub const fn bytes(&self) -> MailboxBytes
pub const fn overflow(&self) -> OverflowPolicy
Trait Implementations§
Source§impl Clone for MailboxConfig
impl Clone for MailboxConfig
Source§fn clone(&self) -> MailboxConfig
fn clone(&self) -> MailboxConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for MailboxConfig
Source§impl Debug for MailboxConfig
impl Debug for MailboxConfig
Source§impl Default for MailboxConfig
impl Default for MailboxConfig
impl Eq for MailboxConfig
Source§impl PartialEq for MailboxConfig
impl PartialEq for MailboxConfig
impl StructuralPartialEq for MailboxConfig
Auto Trait Implementations§
impl Freeze for MailboxConfig
impl RefUnwindSafe for MailboxConfig
impl Send for MailboxConfig
impl Sync for MailboxConfig
impl Unpin for MailboxConfig
impl UnsafeUnpin for MailboxConfig
impl UnwindSafe for MailboxConfig
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