AsyncReadRecvStreamExtra

Trait AsyncReadRecvStreamExtra 

Source
pub trait AsyncReadRecvStreamExtra: Send {
    // Required methods
    fn inner(&mut self) -> &mut (impl AsyncRead + Unpin + Send);
    fn stop(&mut self, code: VarInt) -> Result<()>;
    fn id(&self) -> u64;
}
Expand description

This is a helper trait to work with AsyncReadRecvStream. If you have an AsyncRead + Unpin + Send, you can implement these additional methods and wrap the result in an AsyncReadRecvStream to get a RecvStream that reads from the underlying AsyncRead.

Required Methods§

Source

fn inner(&mut self) -> &mut (impl AsyncRead + Unpin + Send)

Get a mutable reference to the inner AsyncRead.

Getting a reference is easier than implementing all methods on AsyncWrite with forwarders to the inner instance.

Source

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

Stop the stream with the given error code.

Source

fn id(&self) -> u64

A local unique identifier for the stream.

This allows distinguishing between streams, but once the stream is closed, the id may be reused.

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.

Implementors§