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>
impl<ST: TcpClientStack, const N: usize> BufferedStack<ST, N>
Trait Implementations§
Source§impl<ST: TcpClientStack, const N: usize> TcpClientStack for BufferedStack<ST, N>
impl<ST: TcpClientStack, const N: usize> TcpClientStack for BufferedStack<ST, N>
Source§type TcpSocket = BufferedSocket<<ST as TcpClientStack>::TcpSocket, N>
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
type Error = <ST as TcpClientStack>::Error
The type returned when we have an error
Source§fn socket(&mut self) -> Result<Self::TcpSocket, Self::Error>
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>>
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>
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>>
fn send( &mut self, socket: &mut Self::TcpSocket, buffer: &[u8], ) -> Result<usize, Error<Self::Error>>
Write to the stream. Read more
Source§impl<ST: TcpClientStack, const N: usize> TcpExactStack for BufferedStack<ST, N>
impl<ST: TcpClientStack, const N: usize> TcpExactStack for BufferedStack<ST, N>
Source§const RECVBUFLEN: usize = N
const RECVBUFLEN: usize = N
Capacity of the connection’s TCP buffer. Read more
Source§const SENDBUFLEN: usize = N
const SENDBUFLEN: usize = N
Capacity of the connection’s TCP send buffer. Read more
Source§impl<ST: TcpFullStack, const N: usize> TcpFullStack for BufferedStack<ST, N>
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>
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
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more