pub struct VlanTag {
pub tpid: u16,
pub tci: u16,
}Expand description
IEEE 802.1Q VLAN tag
Layout (network byte order): TPID: 16 bits (0x8100 for 802.1Q) TCI: 16 bits = PCP (3) + DEI (1) + VID (12)
Fields§
§tpid: u16Tag Protocol Identifier (always 0x8100 for 802.1Q)
tci: u16Tag Control Information (PCP + DEI + VID)
Implementations§
Source§impl VlanTag
impl VlanTag
Sourcepub fn new(vid: u16, pcp: u8, dei: bool) -> Self
pub fn new(vid: u16, pcp: u8, dei: bool) -> Self
Create a new VLAN tag with the given parameters.
vid: VLAN Identifier (0-4094, 12 bits)pcp: Priority Code Point (0-7, 3 bits)dei: Drop Eligible Indicator
Sourcepub fn from_bytes(bytes: &[u8; 4]) -> Self
pub fn from_bytes(bytes: &[u8; 4]) -> Self
Parse a VLAN tag from 4 bytes in network byte order.
Trait Implementations§
impl Copy for VlanTag
impl Eq for VlanTag
impl StructuralPartialEq for VlanTag
Auto Trait Implementations§
impl Freeze for VlanTag
impl RefUnwindSafe for VlanTag
impl Send for VlanTag
impl Sync for VlanTag
impl Unpin for VlanTag
impl UnwindSafe for VlanTag
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)