[][src]Struct magic_ring_buffer::MagicRingBuffer

pub struct MagicRingBuffer { /* fields omitted */ }

A magic ring buffer (also known as virtual ring buffer, VRB, or a mirrored ring buffer).

Methods

impl MagicRingBuffer[src]

pub fn allocate_mirrored_and_not_swappable_from_dev_shm(
    file_extension: &str,
    buffer_size_not_page_aligned: usize
) -> Result<Self, MirroredMemoryMapCreationError>
[src]

Creates a new instance.

pub fn recovery_if_using_persistent_memory(&self)[src]

In a recovery scenario, we can potentially (a) re-read a message and (b) will lose all messages written but not committed between unread_offset and writer_offset.

pub fn write_some_data(
    &self,
    amount_we_want_to_write: usize,
    writer: impl FnOnce(&mut [u8])
)
[src]

The logic in writer must not panic; if it does, then the entire queue is effectively corrupt and irrecoverable.

pub fn single_reader_read_some_data<E, Reader: FnOnce(&mut [u8]) -> (usize, Result<(), E>)>(
    &self,
    reader: Reader
) -> Result<bool, E>
[src]

Read data, assuming a single reader is active.

This is NOT enforced.

Returns true if there is more data to read.

Trait Implementations

impl Debug for MagicRingBuffer[src]

Auto Trait Implementations

Blanket Implementations

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

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[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, 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]

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