iroh_blobs::util

Trait SendStream

Source
pub trait SendStream: Send {
    // Required methods
    fn send_bytes(
        &mut self,
        bytes: Bytes,
    ) -> impl Future<Output = Result<()>> + Send;
    fn send<const L: usize>(
        &mut self,
        buf: &[u8; L],
    ) -> 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;
}
Expand description

An abstract iroh::endpoint::SendStream.

Required Methods§

Source

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.

Source

fn send<const L: usize>( &mut self, buf: &[u8; L], ) -> impl Future<Output = Result<()>> + Send

Send that sends a fixed sized buffer.

Source

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.

Source

fn reset(&mut self, code: VarInt) -> Result<()>

Reset the stream with the given error code.

Source

fn stopped(&mut self) -> impl Future<Output = Result<Option<VarInt>>> + Send

Wait for the stream to be stopped, returning the error code if it was.

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.

Implementations on Foreign Types§

Source§

impl SendStream for SendStream

Source§

async fn send_bytes(&mut self, bytes: Bytes) -> Result<()>

Source§

async fn send<const L: usize>(&mut self, buf: &[u8; L]) -> Result<()>

Source§

async fn sync(&mut self) -> Result<()>

Source§

fn reset(&mut self, code: VarInt) -> Result<()>

Source§

async fn stopped(&mut self) -> Result<Option<VarInt>>

Source§

impl<W: SendStream> SendStream for &mut W

Source§

async fn send_bytes(&mut self, bytes: Bytes) -> Result<()>

Source§

async fn send<const L: usize>(&mut self, buf: &[u8; L]) -> Result<()>

Source§

async fn sync(&mut self) -> Result<()>

Source§

fn reset(&mut self, code: VarInt) -> Result<()>

Source§

async fn stopped(&mut self) -> Result<Option<VarInt>>

Implementors§