FrameLink

Trait FrameLink 

Source
pub trait FrameLink {
    // Required methods
    async fn send_frame(&mut self, frame: &[u8]) -> Result<(), UlcpError>;
    fn poll_recv_frame(
        &mut self,
        cx: &mut Context<'_>,
    ) -> Poll<Result<Vec<u8>, UlcpError>>;

    // Provided method
    async fn recv_frame(&mut self) -> Result<Vec<u8>, UlcpError> { ... }
}
Expand description

A cancel-safe, frame-oriented ULCP transport.

Required Methods§

Source

async fn send_frame(&mut self, frame: &[u8]) -> Result<(), UlcpError>

Send one complete ULCP frame.

Source

fn poll_recv_frame( &mut self, cx: &mut Context<'_>, ) -> Poll<Result<Vec<u8>, UlcpError>>

Poll for the next complete ULCP frame.

Implementations keep all partial state in self, so cancellation cannot discard a partial frame or unread bytes following a completed frame.

Provided Methods§

Source

async fn recv_frame(&mut self) -> Result<Vec<u8>, UlcpError>

Receive the next complete ULCP frame.

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§