pub struct PcapNGOption<'a> {
    pub code: OptionCode,
    pub len: u16,
    pub value: Cow<'a, [u8]>,
}

Fields§

§code: OptionCode§len: u16§value: Cow<'a, [u8]>

Implementations§

source§

impl<'a> PcapNGOption<'a>

source

pub fn value(&self) -> &[u8]

Return a reference to the option value, as raw bytes (not related to the len field)

source

pub fn as_bytes(&self) -> Option<&[u8]>

Return a reference to the option value, using the len field to limit it, or None if length is invalid

source

pub fn as_i32_le(&self) -> Option<i32>

Return the option value interpreted as i32, or None

Option data length and declared must be exactly 4 bytes

source

pub fn as_u32_le(&self) -> Option<u32>

Return the option value interpreted as u32, or None

Option data length and declared must be exactly 4 bytes

source

pub fn as_i64_le(&self) -> Option<i64>

Return the option value interpreted as i64, or None

Option data length and declared must be exactly 8 bytes

source

pub fn as_u64_le(&self) -> Option<u64>

Return the option value interpreted as u64, or None

Option data length and declared must be exactly 8 bytes

Trait Implementations§

source§

impl<'a> Debug for PcapNGOption<'a>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a> ToVec for PcapNGOption<'a>

Available on crate feature serialize only.
source§

fn to_vec_raw(&self) -> Result<Vec<u8>, GenError>

Serialize to bytes representation (little-endian). Do not check values
source§

fn to_vec(&mut self) -> Result<Vec<u8>, GenError>

Serialize to bytes representation (little-endian). Check values and fix all fields before serializing.
source§

fn fix(&mut self)

Check and correct all fields: use magic, fix lengths fields and other values if possible.

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for PcapNGOption<'a>

§

impl<'a> Send for PcapNGOption<'a>

§

impl<'a> Sync for PcapNGOption<'a>

§

impl<'a> Unpin for PcapNGOption<'a>

§

impl<'a> UnwindSafe for PcapNGOption<'a>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.