Skip to main content

Framer

Trait Framer 

Source
pub trait Framer: Send {
    // Required methods
    fn push(&mut self, data: &[u8], now: Instant, out: &mut Vec<Vec<u8>>);
    fn flush(&mut self) -> Option<Vec<u8>>;

    // Provided methods
    fn poll(&mut self, _now: Instant, _out: &mut Vec<Vec<u8>>) { ... }
    fn deadline(&self) -> Option<Instant> { ... }
}
Expand description

A stateful framer fed with read chunks.

Required Methods§

Source

fn push(&mut self, data: &[u8], now: Instant, out: &mut Vec<Vec<u8>>)

Feed bytes received at now; complete frames are appended to out.

Source

fn flush(&mut self) -> Option<Vec<u8>>

End of stream: the buffered partial frame, if any.

Provided Methods§

Source

fn poll(&mut self, _now: Instant, _out: &mut Vec<Vec<u8>>)

Emit frames that complete by time alone (inter-byte timeout).

Source

fn deadline(&self) -> Option<Instant>

When poll next has something to do.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§