pub struct Value<T> { /* private fields */ }Implementations§
Source§impl<T: Send + Sync + 'static> Value<T>
impl<T: Send + Sync + 'static> Value<T>
pub fn new() -> Self
pub fn new_arc() -> Arc<Self>
pub fn write(&self, item: T)
pub fn write_and_tick(&self, item: T)
pub fn write_if_changed(&self, item: T)where
T: PartialEq,
pub fn write_if_changed_and_tick(&self, item: T)where
T: PartialEq,
Sourcepub fn force_read(&self) -> Option<T>where
T: Clone,
pub fn force_read(&self) -> Option<T>where
T: Clone,
Read and ignore change detection, this always reads a value if initialized.
Sourcepub fn read_async(&self) -> impl FusedFuture<Output = T> + Unpin + '_where
T: Clone,
pub fn read_async(&self) -> impl FusedFuture<Output = T> + Unpin + '_where
T: Clone,
Read a value once changed asynchronously.
Sourcepub fn read_async_owned(
self,
) -> impl FusedFuture<Output = (T, Self)> + Unpin + 'staticwhere
T: Clone,
pub fn read_async_owned(
self,
) -> impl FusedFuture<Output = (T, Self)> + Unpin + 'staticwhere
T: Clone,
Read a value once changed asynchronously.
Sourcepub fn read_async_arc(
self: Arc<Self>,
) -> impl FusedFuture<Output = T> + Unpin + 'staticwhere
T: Clone,
pub fn read_async_arc(
self: Arc<Self>,
) -> impl FusedFuture<Output = T> + Unpin + 'staticwhere
T: Clone,
Read a value once changed asynchronously.
Sourcepub fn make_readable(&self)
pub fn make_readable(&self)
Rewind the tick to make the underlying value readable.
Sourcepub fn clone_uninit(&self) -> Self
pub fn clone_uninit(&self) -> Self
Clone and duplicate the read tick, this makes the current value unreadable.
Sourcepub fn clone_init(&self) -> Self
pub fn clone_init(&self) -> Self
Clone and decrement the read tick, this makes the current value always readable.
Sourcepub fn clone_raw(&self) -> Self
pub fn clone_raw(&self) -> Self
The real Clone implementation that does not guarantee value is readable.
Clone is not implemented since we primarily want to use Arc::clone with this type.
pub fn to_stream(&self) -> impl FusedStream<Item = T> + Unpin + '_where
T: Clone,
pub fn into_stream(self) -> impl FusedStream<Item = T> + Unpinwhere
T: Clone,
pub fn into_stream_arc(self: Arc<Self>) -> impl FusedStream<Item = T> + Unpinwhere
T: Clone,
Trait Implementations§
Auto Trait Implementations§
impl<T> !Freeze for Value<T>
impl<T> RefUnwindSafe for Value<T>
impl<T> Send for Value<T>
impl<T> Sync for Value<T>
impl<T> Unpin for Value<T>
impl<T> UnwindSafe for Value<T>
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