pub struct SeqLock<T: Copy> { /* private fields */ }
Expand description
A simple implementation of a sequential lock. some usage of unsafe, T must be Copy
Implementations§
Source§impl<T: Copy> SeqLock<T>
impl<T: Copy> SeqLock<T>
Sourcepub unsafe fn new(data: T) -> (SeqLockWriter<T>, SeqLockReader<T>)
pub unsafe fn new(data: T) -> (SeqLockWriter<T>, SeqLockReader<T>)
Creates a new SeqLock
and returns a writer and a reader handle.
Optimized for occasional writes and frequent reads
!!WARNING!!
ONLY USE IF ALL THE BELOW CRITERIA ARE MET
- Internal data <= 64 bytes
- VERY frequent reads
§Safety
The data must be Copy
Trait Implementations§
Auto Trait Implementations§
impl<T> !Freeze for SeqLock<T>
impl<T> !RefUnwindSafe for SeqLock<T>
impl<T> Send for SeqLock<T>where
T: Send,
impl<T> Unpin for SeqLock<T>where
T: Unpin,
impl<T> UnwindSafe for SeqLock<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more