pub struct Producer { /* private fields */ }Expand description
Producer endpoint of the MPSC ring buffer.
This type is Clone - multiple producers can write concurrently.
Use try_claim to claim space for writing.
Implementations§
Source§impl Producer
impl Producer
Sourcepub fn try_claim(&mut self, len: usize) -> Result<WriteClaim<'_>, TryClaimError>
pub fn try_claim(&mut self, len: usize) -> Result<WriteClaim<'_>, TryClaimError>
Attempts to claim space for a record with the given payload length.
Returns a WriteClaim that can be written to and then committed.
§Errors
TryClaimError::ZeroLengthiflenis zeroTryClaimError::Fullif the buffer is full
§Safety Contract
len must not exceed 0x7FFF_FFFF (2GB - 1). This is checked with
debug_assert! only.
Sourcepub fn is_disconnected(&self) -> bool
pub fn is_disconnected(&self) -> bool
Returns true if the consumer has been dropped.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Producer
impl RefUnwindSafe for Producer
impl Sync for Producer
impl Unpin for Producer
impl UnwindSafe for Producer
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