pub struct Reader<T: JsCast> { /* private fields */ }
Expand description
A wrapper around ReadableStream
Implementations§
Source§impl<T: JsCast> Reader<T>
impl<T: JsCast> Reader<T>
Sourcepub fn new(stream: &ReadableStream) -> Result<Self, Error>
pub fn new(stream: &ReadableStream) -> Result<Self, Error>
Grab a lock on the given readable stream until dropped.
Sourcepub async fn read(&mut self) -> Result<Option<T>, Error>
pub async fn read(&mut self) -> Result<Option<T>, Error>
Read the next element from the stream, returning None if the stream is done.
pub async fn closed(&self) -> Result<(), Error>
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Reader<T>
impl<T> RefUnwindSafe for Reader<T>where
T: RefUnwindSafe,
impl<T> !Send for Reader<T>
impl<T> !Sync for Reader<T>
impl<T> Unpin for Reader<T>where
T: Unpin,
impl<T> UnwindSafe for Reader<T>where
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