pub enum DatagramsReader {
Byob(ReadableStreamByobReader),
Default(ReadableStreamDefaultReader),
}Expand description
The reader for the datagrams readable stream.
Per the WebTransport spec, the datagrams readable is a regular (non-byte)
web_sys::ReadableStream, which only supports default readers
(this is what Firefox implements); Chrome, however, exposes it as
a byte stream, allowing BYOB reads.
We feature-detect BYOB support and fall back to a default reader.
Variants§
Byob(ReadableStreamByobReader)
A BYOB reader, used when the datagrams readable is a byte stream.
Default(ReadableStreamDefaultReader)
A default reader, used when the datagrams readable is not a byte stream.
Implementations§
Source§impl DatagramsReader
impl DatagramsReader
Sourcepub fn for_stream(readable_stream: ReadableStream) -> Self
pub fn for_stream(readable_stream: ReadableStream) -> Self
Acquire a reader for the given datagrams readable stream, preferring a BYOB reader when the stream supports it.
Sourcepub fn release_lock(&self)
pub fn release_lock(&self)
Release the stream lock held by the reader.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DatagramsReader
impl RefUnwindSafe for DatagramsReader
impl Send for DatagramsReader
impl Sync for DatagramsReader
impl Unpin for DatagramsReader
impl UnsafeUnpin for DatagramsReader
impl UnwindSafe for DatagramsReader
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