pub struct Writer<S: SendStream, V> { /* private fields */ }Expand description
A wrapper around a web_transport_trait::SendStream that will reset on Drop.
Implementations§
Source§impl<S: SendStream, V> Writer<S, V>
impl<S: SendStream, V> Writer<S, V>
Sourcepub fn new(stream: S, version: V) -> Self
pub fn new(stream: S, version: V) -> Self
Create a new writer for the given stream and version.
Sourcepub async fn encode<T: Encode<V> + Debug>(
&mut self,
msg: &T,
) -> Result<(), Error>where
V: Clone,
pub async fn encode<T: Encode<V> + Debug>(
&mut self,
msg: &T,
) -> Result<(), Error>where
V: Clone,
Encode the given message to the stream.
Sourcepub async fn closed(&mut self) -> Result<(), Error>
pub async fn closed(&mut self) -> Result<(), Error>
Wait for the stream to be closed, or the Self::finish to be acknowledged by the peer.
Sourcepub fn set_priority(&mut self, priority: u8)
pub fn set_priority(&mut self, priority: u8)
Set the priority of the stream.
Sourcepub fn with_version<O>(self, version: O) -> Writer<S, O>
pub fn with_version<O>(self, version: O) -> Writer<S, O>
Cast the writer to a different version, used during version negotiation.
Trait Implementations§
Auto Trait Implementations§
impl<S, V> Freeze for Writer<S, V>
impl<S, V> RefUnwindSafe for Writer<S, V>where
V: RefUnwindSafe,
S: RefUnwindSafe,
impl<S, V> Send for Writer<S, V>where
V: Send,
impl<S, V> Sync for Writer<S, V>
impl<S, V> Unpin for Writer<S, V>
impl<S, V> UnwindSafe for Writer<S, V>where
V: UnwindSafe,
S: 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