Enum w5500_ll::Protocol [−][src]
#[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
Closed.
TCP.
UDP.
MACRAW.
MACRAW mode can only be used with socket 0.
Implementations
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
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Auto Trait Implementations
impl RefUnwindSafe for Protocol
impl UnwindSafe for Protocol
Blanket Implementations
Mutably borrows from an owned value. Read more