pub struct LazyReadRef<T>where
T: VcValueType,{ /* private fields */ }Expand description
The result of Vc::lazy_reader: a cell read that can be canceled.
The value is only accessible via LazyReadRef::get. When the LazyReadRef is dropped
without get ever being called, the read is canceled and the task no longer
depends on the cell through it. Otherwise it behaves like a normal read (.await).
This allows reading a cell that is rarely needed ahead of time, e.g. to pass it into synchronous code that decides whether it needs the value, without depending on it when it isn’t needed.
It must be dropped within the task execution that called
lazy_reader, and the same applies to the future returned by
lazy_reader. Otherwise completing that execution panics, which aborts the process.
Implementations§
Source§impl<T> LazyReadRef<T>where
T: VcValueType,
impl<T> LazyReadRef<T>where
T: VcValueType,
Trait Implementations§
Source§impl<T> Debug for LazyReadRef<T>where
T: VcValueType,
impl<T> Debug for LazyReadRef<T>where
T: VcValueType,
Source§impl<T> Drop for LazyReadRef<T>where
T: VcValueType,
impl<T> Drop for LazyReadRef<T>where
T: VcValueType,
Auto Trait Implementations§
impl<T> !Freeze for LazyReadRef<T>
impl<T> Forget for LazyReadRef<T>
impl<T> Move for LazyReadRef<T>
impl<T> RefUnwindSafe for LazyReadRef<T>where
ReadRef<T>: RefUnwindSafe,
impl<T> Send for LazyReadRef<T>
impl<T> Sync for LazyReadRef<T>
impl<T> Unpin for LazyReadRef<T>
impl<T> UnsafeUnpin for LazyReadRef<T>where
ReadRef<T>: UnsafeUnpin,
impl<T> UnwindSafe for LazyReadRef<T>where
ReadRef<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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more