Struct std_embedded_nal::Stack

source ·
pub struct Stack;
Expand description

The operating system’s network stack, implementing embedded_nal::UdpFullStack and others.

The user may instantiate a stack using the Stack::default() function.

The stack can be cloned, as it is not a resource that needs any synchronization. This is not made implicit as Copy, though (although there’s not technical reason not to). That is to alert users to the difficulties that’d arise when copying around a stack rather than using it through some mechanism of synchronization (which is generally required with embedded_nal since version 0.3).

Trait Implementations§

source§

impl Clone for Stack

source§

fn clone(&self) -> Stack

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Default for Stack

source§

fn default() -> Stack

Returns the “default value” for a type. Read more
source§

impl Dns for Stack

§

type Error = Error

The type returned when we have an error
source§

fn get_host_by_name( &mut self, hostname: &str, addr_type: AddrType ) -> Result<IpAddr, Error<Error>>

Resolve the first ip address of a host, given its hostname and a desired address record type to look for
source§

fn get_host_by_address( &mut self, _addr: IpAddr ) -> Result<String<256>, Error<Error>>

Resolve the hostname of a host, given its ip address Read more
source§

impl TcpClientStack for Stack

§

type TcpSocket = TcpSocket

The type returned when we create a new TCP socket
§

type Error = TcpError

The type returned when we have an error
source§

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

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

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

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

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

Write to the stream. Read more
source§

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

Receive data from the stream. Read more
source§

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

Close an existing TCP socket.
source§

impl TcpFullStack for Stack

source§

fn bind(&mut self, socket: &mut 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, _: &mut TcpSocket) -> Result<(), Self::Error>

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

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

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

impl UdpClientStack for Stack

§

type UdpSocket = UdpSocket

The type returned when we create a new UDP socket
§

type Error = Error

The type returned when we have an error
source§

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

Allocate a socket for further use.
source§

fn connect( &mut self, socket: &mut Self::UdpSocket, remote: SocketAddr ) -> Result<()>

Connect a UDP socket with a peer using a dynamically selected port. Read more
source§

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

Send a datagram to the remote host. Read more
source§

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

Read a datagram the remote host has sent to us. Read more
source§

fn close(&mut self, _: Self::UdpSocket) -> Result<()>

Close an existing UDP socket.
source§

impl UdpFullStack for Stack

source§

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

Bind a UDP socket with a specified port
source§

fn send_to( &mut self, socket: &mut UdpSocket, remote: SocketAddr, buffer: &[u8] ) -> Result<(), Error<Error>>

Send a packet to a remote host/port.

Auto Trait Implementations§

§

impl RefUnwindSafe for Stack

§

impl Send for Stack

§

impl Sync for Stack

§

impl Unpin for Stack

§

impl UnwindSafe for Stack

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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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>,

§

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.