Skip to main content

FramedConnection

Struct FramedConnection 

Source
pub struct FramedConnection<S, F, const RC: usize = 256, const WC: usize = 256> { /* private fields */ }
Expand description

A framed Connection over any ByteStream and Framer.

RC caps the per-read chunk and WC caps a single write_all; both are stack buffers, and some HAL BufferedUart::write rejects a write larger than its TX ring, which is what WC exists for.

Implementations§

Source§

impl<S, F, const RC: usize, const WC: usize> FramedConnection<S, F, RC, WC>

Source

pub fn new(stream: S, framer: F) -> Self

Frame stream with framer.

Source

pub fn with_peer(stream: S, framer: F, peer: PeerInfo) -> Self

Frame stream with framer, carrying peer metadata from the accept.

Trait Implementations§

Source§

impl<S, F, const RC: usize, const WC: usize> Connection for FramedConnection<S, F, RC, WC>
where S: ByteStream + Send, F: Framer + Send,

Source§

fn recv(&mut self) -> BoxFut<'_, TransportResult<Option<Vec<u8>>>>

Receive one logical frame. Ok(None) signals the peer closed.
Source§

fn send<'a>(&'a mut self, frame: &'a [u8]) -> BoxFut<'a, TransportResult<()>>

Send one logical frame.
Source§

fn peer(&self) -> &PeerInfo

Peer metadata (remote addr, headers, pre-resolved auth).

Auto Trait Implementations§

§

impl<S, F, const RC: usize = 256, const WC: usize = 256> !RefUnwindSafe for FramedConnection<S, F, RC, WC>

§

impl<S, F, const RC: usize = 256, const WC: usize = 256> !UnwindSafe for FramedConnection<S, F, RC, WC>

§

impl<S, F, const RC: usize, const WC: usize> Freeze for FramedConnection<S, F, RC, WC>
where S: Freeze, F: Freeze,

§

impl<S, F, const RC: usize, const WC: usize> Send for FramedConnection<S, F, RC, WC>
where S: Send, F: Send,

§

impl<S, F, const RC: usize, const WC: usize> Sync for FramedConnection<S, F, RC, WC>
where S: Sync, F: Sync,

§

impl<S, F, const RC: usize, const WC: usize> Unpin for FramedConnection<S, F, RC, WC>
where S: Unpin, F: Unpin,

§

impl<S, F, const RC: usize, const WC: usize> UnsafeUnpin for FramedConnection<S, F, RC, WC>
where S: UnsafeUnpin, F: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.