pub struct GuardedFutureReader<T, A>where
A: AsAccessor,{ /* private fields */ }
Available on crate features
runtime
and component-model
and component-model-async
only.Expand description
A FutureReader
paired with an [Accessor
].
This is an RAII wrapper around FutureReader
that ensures it is closed
when dropped. This can be created through GuardedFutureReader::new
or
FutureReader::guard
.
Implementations§
Source§impl<T, A> GuardedFutureReader<T, A>where
A: AsAccessor,
impl<T, A> GuardedFutureReader<T, A>where
A: AsAccessor,
Sourcepub fn new(accessor: A, reader: FutureReader<T>) -> Self
pub fn new(accessor: A, reader: FutureReader<T>) -> Self
Create a new GuardedFutureReader
with the specified accessor
and reader
.
Sourcepub async fn read(self) -> Option<T>
pub async fn read(self) -> Option<T>
Wrapper for FutureReader::read
.
Sourcepub async fn watch_writer(&mut self)
pub async fn watch_writer(&mut self)
Wrapper for FutureReader::watch_writer
.
Sourcepub fn into_future(self) -> FutureReader<T>
pub fn into_future(self) -> FutureReader<T>
Extracts the underlying FutureReader
from this guard, returning it
back.
Trait Implementations§
Source§impl<T, A> Drop for GuardedFutureReader<T, A>where
A: AsAccessor,
impl<T, A> Drop for GuardedFutureReader<T, A>where
A: AsAccessor,
Source§impl<T, A> From<GuardedFutureReader<T, A>> for FutureReader<T>where
A: AsAccessor,
impl<T, A> From<GuardedFutureReader<T, A>> for FutureReader<T>where
A: AsAccessor,
Source§fn from(guard: GuardedFutureReader<T, A>) -> Self
fn from(guard: GuardedFutureReader<T, A>) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl<T, A> Freeze for GuardedFutureReader<T, A>where
A: Freeze,
impl<T, A> RefUnwindSafe for GuardedFutureReader<T, A>where
A: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, A> Send for GuardedFutureReader<T, A>
impl<T, A> Sync for GuardedFutureReader<T, A>
impl<T, A> Unpin for GuardedFutureReader<T, A>
impl<T, A> UnwindSafe for GuardedFutureReader<T, A>where
A: UnwindSafe,
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
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