embedded_nal_tcpextensions

Struct BufferedStack

Source
pub struct BufferedStack<ST: TcpClientStack, const N: usize>(/* private fields */);
Expand description

A wrapper around a TcpStack that provides TcpExactStack

The implementation is comparatively crude: there’s just a per-socket buffer that data is copied into on demand.

Using this is generally not recommended – TCP stacks usually have the buffers in there somewhere, and and “just” need to expose them.

Implementations§

Source§

impl<ST: TcpClientStack, const N: usize> BufferedStack<ST, N>

Source

pub fn new(wrapped: ST) -> Self

Trait Implementations§

Source§

impl<ST: TcpClientStack, const N: usize> TcpClientStack for BufferedStack<ST, N>

Source§

type TcpSocket = BufferedSocket<<ST as TcpClientStack>::TcpSocket, N>

The type returned when we create a new TCP socket
Source§

type Error = <ST as TcpClientStack>::Error

The type returned when we have an error
Source§

fn socket(&mut self) -> Result<Self::TcpSocket, Self::Error>

Open a socket for usage as a TCP client. Read more
Source§

fn connect( &mut self, socket: &mut Self::TcpSocket, addr: SocketAddr, ) -> Result<(), Error<Self::Error>>

Connect to the given remote host and port. Read more
Source§

fn is_connected( &mut self, socket: &Self::TcpSocket, ) -> Result<bool, Self::Error>

Check if this socket is connected
Source§

fn send( &mut self, socket: &mut Self::TcpSocket, buffer: &[u8], ) -> Result<usize, Error<Self::Error>>

Write to the stream. Read more
Source§

fn receive( &mut self, socket: &mut Self::TcpSocket, buffer: &mut [u8], ) -> Result<usize, Error<Self::Error>>

Receive data from the stream. Read more
Source§

fn close(&mut self, socket: Self::TcpSocket) -> Result<(), Self::Error>

Close an existing TCP socket.
Source§

impl<ST: TcpClientStack, const N: usize> TcpExactStack for BufferedStack<ST, N>

Source§

const RECVBUFLEN: usize = N

Capacity of the connection’s TCP buffer. Read more
Source§

const SENDBUFLEN: usize = N

Capacity of the connection’s TCP send buffer. Read more
Source§

fn receive_exact( &mut self, socket: &mut Self::TcpSocket, buffer: &mut [u8], ) -> Result<(), Self::Error>

Receive data from the stream. Read more
Source§

fn send_all( &mut self, socket: &mut Self::TcpSocket, buffer: &[u8], ) -> Result<(), Error<Self::Error>>

Send all this data to the stream. Read more
Source§

impl<ST: TcpFullStack, const N: usize> TcpFullStack for BufferedStack<ST, N>

Source§

fn bind( &mut self, socket: &mut Self::TcpSocket, port: u16, ) -> Result<(), Self::Error>

Create a new TCP socket and bind it to the specified local port. Read more
Source§

fn listen(&mut self, socket: &mut Self::TcpSocket) -> Result<(), Self::Error>

Begin listening for connection requests on a previously-bound socket. Read more
Source§

fn accept( &mut self, socket: &mut Self::TcpSocket, ) -> Result<(Self::TcpSocket, SocketAddr), Error<Self::Error>>

Accept an active connection request on a listening socket. Read more

Auto Trait Implementations§

§

impl<ST, const N: usize> Freeze for BufferedStack<ST, N>
where ST: Freeze,

§

impl<ST, const N: usize> RefUnwindSafe for BufferedStack<ST, N>
where ST: RefUnwindSafe,

§

impl<ST, const N: usize> Send for BufferedStack<ST, N>
where ST: Send,

§

impl<ST, const N: usize> Sync for BufferedStack<ST, N>
where ST: Sync,

§

impl<ST, const N: usize> Unpin for BufferedStack<ST, N>
where ST: Unpin,

§

impl<ST, const N: usize> UnwindSafe for BufferedStack<ST, N>
where ST: UnwindSafe,

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.