Skip to main content

Writer

Struct Writer 

Source
pub struct Writer<T> { /* private fields */ }
Expand description

Single-writer append handle for an AtomicLog.

The core design assumes exactly one active writer. If a caller wants to share write access across threads, it must add its own external synchronization.

Implementations§

Source§

impl<T> Writer<T>

Source

pub fn log(&self) -> AtomicLog<T>

Returns a clonable read handle for this writer’s log.

Source

pub fn retained_capacity(&self) -> usize

Returns the configured logical retained capacity, in elements.

Source

pub fn segment_capacity(&self) -> usize

Returns the fixed segment size, in elements.

Source

pub fn append_batch(&mut self, values: impl IntoIterator<Item = T>)

Appends multiple values to the log.

Values within the same segment are published with a single atomic store rather than one per element. Segment rolls are performed as needed, the same as append.

Source

pub fn append(&mut self, value: T)

Appends one value to the log and publishes it for readers.

Values are written into the current head segment. If that segment is full, the writer allocates a new head segment, publishes it, and continues there.

Trait Implementations§

Source§

impl<T> Drop for Writer<T>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl<T> From<Writer<T>> for AtomicLog<T>

Source§

fn from(writer: Writer<T>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<T> Freeze for Writer<T>

§

impl<T> !RefUnwindSafe for Writer<T>

§

impl<T> Send for Writer<T>
where T: Send + Sync,

§

impl<T> Sync for Writer<T>
where T: Send + Sync,

§

impl<T> Unpin for Writer<T>

§

impl<T> UnsafeUnpin for Writer<T>

§

impl<T> !UnwindSafe for Writer<T>

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Source§

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.