Enum ublox_sockets::Socket
source · [−]#[non_exhaustive]
pub enum Socket<const TIMER_HZ: u32, const L: usize> {
Udp(UdpSocket<TIMER_HZ, L>),
Tcp(TcpSocket<TIMER_HZ, L>),
}
Expand description
A network socket.
This enumeration abstracts the various types of sockets based on the IP protocol.
To downcast a Socket
value to a concrete socket, use the AnySocket trait,
e.g. to get UdpSocket
, call UdpSocket::downcast(socket)
.
It is usually more convenient to use SocketSet::get instead.
Variants (Non-exhaustive)
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Udp(UdpSocket<TIMER_HZ, L>)
Tcp(TcpSocket<TIMER_HZ, L>)
Implementations
sourceimpl<const TIMER_HZ: u32, const L: usize> Socket<TIMER_HZ, L>
impl<const TIMER_HZ: u32, const L: usize> Socket<TIMER_HZ, L>
sourcepub fn handle(&self) -> SocketHandle
pub fn handle(&self) -> SocketHandle
Return the socket handle.
pub fn get_type(&self) -> SocketType
pub fn should_update_available_data(&mut self, ts: Instant<TIMER_HZ>) -> bool
pub fn available_data(&self) -> usize
pub fn recycle(&self, ts: Instant<TIMER_HZ>) -> bool
pub fn closed_by_remote(&mut self, ts: Instant<TIMER_HZ>)
pub fn set_available_data(&mut self, available_data: usize)
pub fn rx_enqueue_slice(&mut self, data: &[u8]) -> usize
pub fn rx_window(&self) -> usize
pub fn can_recv(&self) -> bool
Trait Implementations
Auto Trait Implementations
impl<const TIMER_HZ: u32, const L: usize> RefUnwindSafe for Socket<TIMER_HZ, L>
impl<const TIMER_HZ: u32, const L: usize> Send for Socket<TIMER_HZ, L>
impl<const TIMER_HZ: u32, const L: usize> Sync for Socket<TIMER_HZ, L>
impl<const TIMER_HZ: u32, const L: usize> Unpin for Socket<TIMER_HZ, L>
impl<const TIMER_HZ: u32, const L: usize> UnwindSafe for Socket<TIMER_HZ, L>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more