Enum w5500_ll::BufferSize [−][src]
#[repr(u8)]
pub enum BufferSize {
KB0,
KB1,
KB2,
KB4,
KB8,
KB16,
}
Expand description
RX and TX buffer sizes.
This is an argument of Registers::set_sn_rxbuf_size
and
Registers::set_sn_txbuf_size
.
Variants
0 KiB
1 KiB
2 KiB
4 KiB
8 KiB
16 KiB
Implementations
Get the buffer size in bytes.
Example
use w5500_ll::BufferSize;
assert_eq!(BufferSize::KB0.size_in_bytes(), 0);
assert_eq!(BufferSize::KB1.size_in_bytes(), 1 * 1024);
assert_eq!(BufferSize::KB2.size_in_bytes(), 2 * 1024);
assert_eq!(BufferSize::KB4.size_in_bytes(), 4 * 1024);
assert_eq!(BufferSize::KB8.size_in_bytes(), 8 * 1024);
assert_eq!(BufferSize::KB16.size_in_bytes(), 16 * 1024);
Trait Implementations
Get the register value from a buffer size.
Example
use w5500_ll::BufferSize;
assert_eq!(u8::from(BufferSize::KB0), 0);
assert_eq!(u8::from(BufferSize::KB1), 1);
assert_eq!(u8::from(BufferSize::KB2), 2);
assert_eq!(u8::from(BufferSize::KB4), 4);
assert_eq!(u8::from(BufferSize::KB8), 8);
assert_eq!(u8::from(BufferSize::KB16), 16);
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
Get the buffer size given the register value.
Example
use w5500_ll::BufferSize;
assert_eq!(BufferSize::try_from(0), Ok(BufferSize::KB0));
assert_eq!(BufferSize::try_from(1), Ok(BufferSize::KB1));
assert_eq!(BufferSize::try_from(2), Ok(BufferSize::KB2));
assert_eq!(BufferSize::try_from(4), Ok(BufferSize::KB4));
assert_eq!(BufferSize::try_from(8), Ok(BufferSize::KB8));
assert_eq!(BufferSize::try_from(16), Ok(BufferSize::KB16));
assert_eq!(BufferSize::try_from(17), Err(17));
Auto Trait Implementations
impl RefUnwindSafe for BufferSize
impl Send for BufferSize
impl Sync for BufferSize
impl Unpin for BufferSize
impl UnwindSafe for BufferSize
Blanket Implementations
Mutably borrows from an owned value. Read more