Skip to main content

new

Function new 

Source
pub fn new<T>(initial_value: T) -> (Writer<T>, Reader<T>)
where T: AnyBitPattern,
Expand description

Creates a new seqlock initialised with initial_value.

Returns a paired (Writer, Reader). Additional readers can be obtained by cloning the Reader.

ยงExamples

use low_latency_data_structures::seqlock::new;

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