Skip to main content

Writer

Struct Writer 

Source
pub struct Writer<T>
where T: AnyBitPattern,
{ /* private fields */ }
Expand description

The writing handle of a SeqLock.

Writer is Send but not Sync: at most one thread may write at a time. To enforce that, the type is neither Clone nor Copy.

Implementations§

Source§

impl<T> Writer<T>
where T: AnyBitPattern,

Source

pub fn write(&self, value: T)

Writes a new value, replacing the current one.

Wait-free. Concurrent readers may observe the in-progress write but will retry until they see a consistent value.

§Examples
use low_latency_data_structures::seqlock::new;

let (writer, reader) = new(0u64);
writer.write(7);
assert_eq!(reader.read(), 7);

Trait Implementations§

Source§

impl<T> Debug for Writer<T>
where T: AnyBitPattern,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T> Send for Writer<T>
where T: AnyBitPattern,

Auto Trait Implementations§

§

impl<T> !RefUnwindSafe for Writer<T>

§

impl<T> !Sync for Writer<T>

§

impl<T> !UnwindSafe for Writer<T>

§

impl<T> Freeze for Writer<T>
where Arc<CachePadded<SeqLockInner<T>>>: Freeze,

§

impl<T> Unpin for Writer<T>
where Arc<CachePadded<SeqLockInner<T>>>: Unpin,

§

impl<T> UnsafeUnpin for Writer<T>
where Arc<CachePadded<SeqLockInner<T>>>: UnsafeUnpin,

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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.