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