pub struct Writer<T, O> { /* private fields */ }Expand description
Not realtime safe object which can change the internal T value.
Implementations§
Source§impl<T, O> Writer<T, O>
impl<T, O> Writer<T, O>
Sourcepub fn build_reader(&mut self) -> Option<Reader<T>>
pub fn build_reader(&mut self) -> Option<Reader<T>>
get a Reader if none exists
Source§impl<T: Absorb<O>, O> Writer<T, O>
impl<T: Absorb<O>, O> Writer<T, O>
Sourcepub fn try_lock(&mut self) -> Option<WriteGuard<'_, T, O>>
pub fn try_lock(&mut self) -> Option<WriteGuard<'_, T, O>>
doesn’t block. Returns None if the Reader has a ReadGuard pointing to the old value.
Source§impl<T: Sync, O> Writer<T, O>
impl<T: Sync, O> Writer<T, O>
Sourcepub fn read(&self) -> &T
pub fn read(&self) -> &T
The Value returned may be newer than the version the reader is currently seeing.
This value will be written to next.
If this is called after swapping the write_lock this will return an older value.
To get the newest value lock the writer and call Writeguard::read.
Needs T: Sync because maybe this is the value the reader is curently reading
Trait Implementations§
impl<T: Send, O: Send> Send for Writer<T, O>
SAFETY: owns T and O
impl<T: Sync, O> Sync for Writer<T, O>
SAFETY: &self fn can only create a &T and never gives shared access to O
Auto Trait Implementations§
impl<T, O> Freeze for Writer<T, O>
impl<T, O> !RefUnwindSafe for Writer<T, O>
impl<T, O> Unpin for Writer<T, O>
impl<T, O> !UnwindSafe for Writer<T, O>
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