pub struct Orbital<T: CellType> { /* private fields */ }Expand description
One cell, typed. Cheap to clone; every clone is the same place.
Implementations§
Source§impl<T: CellType> Orbital<T>
impl<T: CellType> Orbital<T>
pub fn id(&self) -> CellId
pub fn load(&self) -> Result<T>
pub fn store(&self, value: T) -> Result<()>
Sourcepub fn version(&self) -> Result<u32>
pub fn version(&self) -> Result<u32>
The write count, the thing Self::wait_changed waits on. Take it
before reading the value, and the wait misses nothing in between.
Sourcepub fn wait_changed(&self, since: u32) -> Result<u32>
pub fn wait_changed(&self, since: u32) -> Result<u32>
Park until the cell has been written since since, then return the
count now. Coalescing: ten writes while parked wake the caller once,
and Self::load gives the latest. A released cell wakes every waiter
with Error::Stale. Blocking; an async runtime wraps it.
Sourcepub fn compare_exchange(&self, current: T, new: T) -> Result<Result<T, T>>
pub fn compare_exchange(&self, current: T, new: T) -> Result<Result<T, T>>
Store new only if the cell still holds current. Ok(Ok(previous))
on success, Ok(Err(actual)) when it held something else.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Orbital<T>where
PhantomData<T>: Freeze,
impl<T> RefUnwindSafe for Orbital<T>where
PhantomData<T>: RefUnwindSafe,
impl<T> Send for Orbital<T>where
PhantomData<T>: Send,
impl<T> Sync for Orbital<T>where
PhantomData<T>: Sync,
impl<T> Unpin for Orbital<T>where
PhantomData<T>: Unpin,
impl<T> UnsafeUnpin for Orbital<T>where
PhantomData<T>: UnsafeUnpin,
impl<T> UnwindSafe for Orbital<T>where
PhantomData<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