Module etherparse::ether_type

source ·
Expand description

Constants for the ethertype values for easy importing (e.g. use ether_type::*;).

The constants only exist for convenience so you can import them (use ether_type::*) without a need to write EtherType:: in front of every constant.

You can access the underlying u16 value by using .0 and any u16 can be converted to an EtherType:

use etherparse::{ether_type::IPV4, EtherType};

assert_eq!(IPV4.0, 0x0800);
assert_eq!(IPV4, EtherType(0x0800));
let num: EtherType = 0x0800.into();
assert_eq!(IPV4, num);

Constants§