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