[][src]Struct lock_free_multi_producer_single_consumer_ring_buffer::RingBufferProducer

pub struct RingBufferProducer<T: Sized> { /* fields omitted */ }

Produces bursts of messages to put into the ring buffer.

Methods

impl<T: Sized> RingBufferProducer<T>
[src]

pub fn acquire<'a>(
    &'a self,
    count: usize
) -> Result<RingBufferProducerGuard<'a, T>, ()>
[src]

Request a space of a given count in the ring buffer.

Returns a slice offset into the (external) ring buffer for which count bytes are available.

Should be released with produce().

Slice data should be treated as uninitialized, not necessarily zero'd.

  • count should not be zero.
  • count should not exceed the buffer size.

Returns an Err if the producer could acquire a slice of the desired count.

pub fn repeatedly_acquire_and_try_to_populate(&self, populate_with: &mut Vec<T>)
[src]

A wrapper around acquire, that retries progressively smaller counts if acquire fails, eventually reducing to a count of 1 before giving up.

If it gives up, there will be values remaining in populate_with on return.

All the other original values in populate_with are moved into the ring buffer (and so are not dropped).

populate_with can have a .len() of zero.

Trait Implementations

impl<T: Eq + Sized> Eq for RingBufferProducer<T>
[src]

impl<T: PartialOrd + Sized> PartialOrd<RingBufferProducer<T>> for RingBufferProducer<T>
[src]

impl<T: PartialEq + Sized> PartialEq<RingBufferProducer<T>> for RingBufferProducer<T>
[src]

impl<T: Ord + Sized> Ord for RingBufferProducer<T>
[src]

fn max(self, other: Self) -> Self
1.21.0
[src]

Compares and returns the maximum of two values. Read more

fn min(self, other: Self) -> Self
1.21.0
[src]

Compares and returns the minimum of two values. Read more

impl<T: Debug + Sized> Debug for RingBufferProducer<T>
[src]

Auto Trait Implementations

impl<T> !Send for RingBufferProducer<T>

impl<T> !Sync for RingBufferProducer<T>

Blanket Implementations

impl<T> From for T
[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]