#[repr(u8)]pub enum Protocol {
Closed,
Tcp,
Udp,
Macraw,
}
Expand description
Socket protocol.
This is used by SocketMode::protocol
method for the sn_mr
register.
Variants§
Implementations§
source§impl Protocol
impl Protocol
sourcepub const fn from_raw(val: u8) -> Result<Self, u8>
pub const fn from_raw(val: u8) -> Result<Self, u8>
Convert a raw u8
to an Protocol
.
Bit values that do not correspond to a protocol will be returned in the
Err
variant of the result.
Example
use w5500_ll::Protocol;
assert_eq!(Protocol::from_raw(0b0000), Ok(Protocol::Closed));
assert_eq!(Protocol::from_raw(0b0001), Ok(Protocol::Tcp));
assert_eq!(Protocol::from_raw(0b0010), Ok(Protocol::Udp));
assert_eq!(Protocol::from_raw(0b0100), Ok(Protocol::Macraw));
assert_eq!(Protocol::from_raw(0b0101), Err(0b0101));
Trait Implementations§
source§impl Ord for Protocol
impl Ord for Protocol
source§impl PartialEq<Protocol> for Protocol
impl PartialEq<Protocol> for Protocol
source§impl PartialOrd<Protocol> for Protocol
impl PartialOrd<Protocol> for Protocol
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Copy for Protocol
impl Eq for Protocol
impl StructuralEq for Protocol
impl StructuralPartialEq for Protocol
Auto Trait Implementations§
impl RefUnwindSafe for Protocol
impl Send for Protocol
impl Sync for Protocol
impl Unpin for Protocol
impl UnwindSafe for Protocol
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