Struct GuardedStreamReader
pub struct GuardedStreamReader<T, A>where
A: AsAccessor,{ /* private fields */ }
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§
§impl<T, A> GuardedStreamReader<T, A>where
A: AsAccessor,
impl<T, A> GuardedStreamReader<T, A>where
A: AsAccessor,
pub fn new(accessor: A, reader: StreamReader<T>) -> GuardedStreamReader<T, A>
pub fn new(accessor: A, reader: StreamReader<T>) -> GuardedStreamReader<T, A>
Create a new GuardedStreamReader
with the specified accessor
and
reader
.
pub async fn read<B>(&mut self, buffer: B) -> B
pub async fn read<B>(&mut self, buffer: B) -> B
Wrapper for StreamReader::read
.
pub async fn watch_writer(&mut self)
pub async fn watch_writer(&mut self)
Wrapper for StreamReader::watch_writer
.
pub 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§
§impl<T, A> Drop for GuardedStreamReader<T, A>where
A: AsAccessor,
impl<T, A> Drop for GuardedStreamReader<T, A>where
A: AsAccessor,
§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,
§fn from(guard: GuardedStreamReader<T, A>) -> StreamReader<T>
fn from(guard: GuardedStreamReader<T, A>) -> StreamReader<T>
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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