pub trait SendStream: Send {
// Required methods
fn send_bytes(
&mut self,
bytes: Bytes,
) -> impl Future<Output = Result<()>> + Send;
fn send(&mut self, buf: &[u8]) -> impl Future<Output = Result<()>> + Send;
fn sync(&mut self) -> impl Future<Output = Result<()>> + Send;
fn reset(&mut self, code: VarInt) -> Result<()>;
fn stopped(&mut self) -> impl Future<Output = Result<Option<VarInt>>> + Send;
fn id(&self) -> u64;
}
Expand description
An abstract iroh::endpoint::SendStream
.
Required Methods§
Sourcefn send_bytes(
&mut self,
bytes: Bytes,
) -> impl Future<Output = Result<()>> + Send
fn send_bytes( &mut self, bytes: Bytes, ) -> impl Future<Output = Result<()>> + Send
Send bytes to the stream. This takes a Bytes
because iroh can directly use them.
This method is not cancellation safe. Even if this does not resolve, some bytes may have been written when previously polled.
Sourcefn send(&mut self, buf: &[u8]) -> impl Future<Output = Result<()>> + Send
fn send(&mut self, buf: &[u8]) -> impl Future<Output = Result<()>> + Send
Send that sends a fixed sized buffer.
Sourcefn sync(&mut self) -> impl Future<Output = Result<()>> + Send
fn sync(&mut self) -> impl Future<Output = Result<()>> + Send
Sync the stream. Not needed for iroh, but needed for intermediate buffered streams such as compression.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.