pub struct SendStream { /* private fields */ }Expand description
A byte stream sent to the remote peer.
Implementations§
Source§impl SendStream
impl SendStream
Sourcepub async fn write(&mut self, buf: &[u8]) -> Result<(), Error>
pub async fn write(&mut self, buf: &[u8]) -> Result<(), Error>
Write all of the provided bytes to the stream.
Sourcepub async fn write_buf<B: Buf>(&mut self, buf: &mut B) -> Result<usize, Error>
pub async fn write_buf<B: Buf>(&mut self, buf: &mut B) -> Result<usize, Error>
Write some of the provided buffer to the stream.
Sourcepub fn reset(&mut self, reason: &str)
pub fn reset(&mut self, reason: &str)
Send an immediate reset, closing the stream with an error.
Sourcepub fn finish(&mut self) -> Result<(), Error>
pub fn finish(&mut self) -> Result<(), Error>
Mark the stream as finished.
This is called on drop, but can also be invoked manually.
Sourcepub fn set_priority(&mut self, priority: i32)
pub fn set_priority(&mut self, priority: i32)
Set the stream’s priority.
Streams with higher values are sent first, but delivery order is not guaranteed.
Trait Implementations§
Source§impl AsyncWrite for SendStream
impl AsyncWrite for SendStream
Source§fn poll_write(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
buf: &[u8],
) -> Poll<Result<usize>>
fn poll_write( self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &[u8], ) -> Poll<Result<usize>>
Attempt to write bytes from
buf into the object. Read moreSource§fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>
fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>
Attempt to flush the object, ensuring that any buffered data reach
their destination. Read more
Source§impl SendStream for SendStream
Available on target_family=wasm only.
impl SendStream for SendStream
Available on
target_family=wasm only.Source§async fn write(&mut self, buf: &[u8]) -> Result<usize, Self::Error>
async fn write(&mut self, buf: &[u8]) -> Result<usize, Self::Error>
Write some of the buffer to the stream.
Source§fn set_priority(&mut self, order: u8)
fn set_priority(&mut self, order: u8)
Set the stream’s priority. Read more
Source§fn finish(&mut self) -> Result<(), Self::Error>
fn finish(&mut self) -> Result<(), Self::Error>
Mark the stream as finished, erroring on any future writes. Read more
Source§fn reset(&mut self, code: u32)
fn reset(&mut self, code: u32)
Immediately close the stream and discard any remaining data. Read more
Source§async fn closed(&mut self) -> Result<(), Self::Error>
async fn closed(&mut self) -> Result<(), Self::Error>
Block until the stream is closed by either side. Read more
Source§fn write_buf<B>(
&mut self,
buf: &mut B,
) -> impl Future<Output = Result<usize, Self::Error>> + MaybeSend
fn write_buf<B>( &mut self, buf: &mut B, ) -> impl Future<Output = Result<usize, Self::Error>> + MaybeSend
Write the given buffer to the stream, advancing the internal position.
Source§fn write_chunk(
&mut self,
chunk: Bytes,
) -> impl Future<Output = Result<(), Self::Error>> + MaybeSend
fn write_chunk( &mut self, chunk: Bytes, ) -> impl Future<Output = Result<(), Self::Error>> + MaybeSend
Write the entire Bytes chunk to the stream, potentially avoiding a copy.
Auto Trait Implementations§
impl Freeze for SendStream
impl !RefUnwindSafe for SendStream
impl !Send for SendStream
impl !Sync for SendStream
impl Unpin for SendStream
impl UnsafeUnpin for SendStream
impl !UnwindSafe for SendStream
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