pub struct StreamReader<B> { /* private fields */ }
runtime
and component-model
and component-model-async
only.Expand description
Represents the readable end of a Component Model stream
.
In order to pass this end to guest code, first convert it to a
HostStream
using the into
method.
Implementations§
Source§impl<B> StreamReader<B>
impl<B> StreamReader<B>
Sourcepub fn is_closed(&self) -> bool
pub fn is_closed(&self) -> bool
Returns whether this stream is “closed” meaning that the other end of the stream has been dropped.
Sourcepub async fn read(&mut self, accessor: impl AsAccessor, buffer: B) -> Bwhere
B: Send + 'static,
pub async fn read(&mut self, accessor: impl AsAccessor, buffer: B) -> Bwhere
B: Send + 'static,
Read values from this stream
.
The returned Future
will yield a (Some(_), _)
if the read completed
(possibly with zero items if the write was empty). It will return
(None, _)
if the read failed due to the closure of the write end. In
either case, the returned buffer will be the same one passed as a
parameter, with zero or more items added.
§Panics
Panics if the store that the [Accessor
] is derived from does not own
this future.
Sourcepub async fn watch_writer(&mut self, accessor: impl AsAccessor)where
B: Send + 'static,
pub async fn watch_writer(&mut self, accessor: impl AsAccessor)where
B: Send + 'static,
Wait until the write end of this stream
is dropped.
§Panics
Panics if the store that the [Accessor
] is derived from does not own
this future.
Trait Implementations§
Source§impl<B> Drop for StreamReader<B>
impl<B> Drop for StreamReader<B>
Source§impl<T, B> From<StreamReader<B>> for HostStream<T>
impl<T, B> From<StreamReader<B>> for HostStream<T>
Source§fn from(value: StreamReader<B>) -> Self
fn from(value: StreamReader<B>) -> Self
Auto Trait Implementations§
impl<B> Freeze for StreamReader<B>
impl<B> !RefUnwindSafe for StreamReader<B>
impl<B> Send for StreamReader<B>where
B: Send,
impl<B> Sync for StreamReader<B>where
B: Send,
impl<B> Unpin for StreamReader<B>
impl<B> !UnwindSafe for StreamReader<B>
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
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> ⓘ
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> ⓘ
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