Struct etherparse::SingleVlanHeader
source · pub struct SingleVlanHeader {
pub pcp: VlanPcp,
pub drop_eligible_indicator: bool,
pub vlan_id: VlanId,
pub ether_type: EtherType,
}
Expand description
IEEE 802.1Q VLAN Tagging Header
Fields§
§pcp: VlanPcp
A 3 bit number which refers to the IEEE 802.1p class of service and maps to the frame priority level.
drop_eligible_indicator: bool
Indicate that the frame may be dropped under the presence of congestion.
vlan_id: VlanId
12 bits vland identifier.
ether_type: EtherType
“Tag protocol identifier”: Type id of content after this header. Refer to the “EtherType” for a list of possible supported values.
Implementations§
source§impl SingleVlanHeader
impl SingleVlanHeader
pub const SERIALIZED_SIZE: usize = 4usize
👎Deprecated since 0.14.0: Use
SingleVlanHeader::LEN
insteadsourcepub fn read_from_slice(
slice: &[u8]
) -> Result<(SingleVlanHeader, &[u8]), LenError>
👎Deprecated since 0.10.1: Use SingleVlanHeader::from_slice instead.
pub fn read_from_slice( slice: &[u8] ) -> Result<(SingleVlanHeader, &[u8]), LenError>
Read an SingleVlanHeader from a slice and return the header & unused parts of the slice.
sourcepub fn from_slice(slice: &[u8]) -> Result<(SingleVlanHeader, &[u8]), LenError>
pub fn from_slice(slice: &[u8]) -> Result<(SingleVlanHeader, &[u8]), LenError>
Read an SingleVlanHeader from a slice and return the header & unused parts of the slice.
sourcepub fn from_bytes(bytes: [u8; 4]) -> SingleVlanHeader
pub fn from_bytes(bytes: [u8; 4]) -> SingleVlanHeader
Read an SingleVlanHeader from a static sized byte array.
sourcepub fn read<T: Read + Seek + Sized>(
reader: &mut T
) -> Result<SingleVlanHeader, Error>
Available on crate feature std
only.
pub fn read<T: Read + Seek + Sized>( reader: &mut T ) -> Result<SingleVlanHeader, Error>
std
only.Read a IEEE 802.1Q VLAN tagging header
sourcepub fn write<T: Write + Sized>(&self, writer: &mut T) -> Result<(), Error>
Available on crate feature std
only.
pub fn write<T: Write + Sized>(&self, writer: &mut T) -> Result<(), Error>
std
only.Write the IEEE 802.1Q VLAN tagging header
sourcepub fn header_len(&self) -> usize
pub fn header_len(&self) -> usize
Length of the serialized header in bytes.
Trait Implementations§
source§impl Clone for SingleVlanHeader
impl Clone for SingleVlanHeader
source§fn clone(&self) -> SingleVlanHeader
fn clone(&self) -> SingleVlanHeader
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for SingleVlanHeader
impl Debug for SingleVlanHeader
source§impl Default for SingleVlanHeader
impl Default for SingleVlanHeader
source§fn default() -> SingleVlanHeader
fn default() -> SingleVlanHeader
Returns the “default value” for a type. Read more
source§impl PartialEq for SingleVlanHeader
impl PartialEq for SingleVlanHeader
source§fn eq(&self, other: &SingleVlanHeader) -> bool
fn eq(&self, other: &SingleVlanHeader) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl Eq for SingleVlanHeader
impl StructuralPartialEq for SingleVlanHeader
Auto Trait Implementations§
impl Freeze for SingleVlanHeader
impl RefUnwindSafe for SingleVlanHeader
impl Send for SingleVlanHeader
impl Sync for SingleVlanHeader
impl Unpin for SingleVlanHeader
impl UnwindSafe for SingleVlanHeader
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