[][src]Struct ublox_cellular::sockets::UdpSocket

pub struct UdpSocket<L: ArrayLength<u8>> { /* fields omitted */ }

A User Datagram Protocol socket.

A UDP socket is bound to a specific endpoint, and owns transmit and receive packet buffers.

Implementations

impl<L: ArrayLength<u8>> UdpSocket<L>[src]

pub fn new(socket_id: u8) -> UdpSocket<L>[src]

Create an UDP socket with the given buffers.

pub fn handle(&self) -> SocketHandle[src]

Return the socket handle.

pub fn endpoint(&self) -> SocketAddr[src]

Return the bound endpoint.

pub fn set_available_data(&mut self, available_data: usize)[src]

Set available data.

pub fn get_available_data(&self) -> usize[src]

Get the number of bytes available to ingress.

pub fn rx_window(&self) -> usize[src]

pub fn bind<T: Into<SocketAddr>>(&mut self, endpoint: T) -> Result<(), Error>[src]

Bind the socket to the given endpoint.

This function returns Err(Error::Illegal) if the socket was open (see is_open), and Err(Error::Unaddressable) if the port in the given endpoint is zero.

pub fn is_open(&self) -> bool[src]

Check whether the socket is open.

pub fn can_recv(&self) -> bool[src]

Check whether the receive buffer is full.

pub fn recv<'b, F, R>(&'b mut self, f: F) -> Result<R, Error> where
    F: FnOnce(&'b mut [u8]) -> (usize, R)
[src]

Dequeue a packet received from a remote endpoint, and return the endpoint as well as a pointer to the payload.

This function returns Err(Error::Exhausted) if the receive buffer is empty.

pub fn recv_slice(&mut self, data: &mut [u8]) -> Result<usize, Error>[src]

Dequeue a packet received from a remote endpoint, copy the payload into the given slice, and return the amount of octets copied as well as the endpoint.

See also recv.

pub fn rx_enqueue_slice(&mut self, data: &[u8]) -> usize[src]

pub fn peek(&mut self, size: usize) -> Result<&[u8], Error>[src]

Peek at a packet received from a remote endpoint, and return the endpoint as well as a pointer to the payload without removing the packet from the receive buffer. This function otherwise behaves identically to recv.

It returns Err(Error::Exhausted) if the receive buffer is empty.

pub fn peek_slice(&mut self, data: &mut [u8]) -> Result<usize, Error>[src]

Peek at a packet received from a remote endpoint, copy the payload into the given slice, and return the amount of octets copied as well as the endpoint without removing the packet from the receive buffer. This function otherwise behaves identically to recv_slice.

See also peek.

pub fn close(&mut self)[src]

Trait Implementations

impl<L: ArrayLength<u8>> AnySocket<L> for UdpSocket<L>[src]

impl<L: ArrayLength<u8>> Into<Socket<L>> for UdpSocket<L>[src]

Auto Trait Implementations

impl<L> RefUnwindSafe for UdpSocket<L> where
    <L as ArrayLength<u8>>::ArrayType: RefUnwindSafe

impl<L> Send for UdpSocket<L>

impl<L> Sync for UdpSocket<L>

impl<L> Unpin for UdpSocket<L> where
    <L as ArrayLength<u8>>::ArrayType: Unpin

impl<L> UnwindSafe for UdpSocket<L> where
    <L as ArrayLength<u8>>::ArrayType: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T[src]

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.