Skip to main content

ExtTime

Struct ExtTime 

Source
pub struct ExtTime {
    pub sct_high: Option<u32>,
    pub sct_low: Option<u32>,
    pub ert: Option<u32>,
    pub slc: Option<u32>,
    pub pi_specific: u8,
}
Expand description

A decoded EXT_TIME header extension (RFC 5651 §5.2.2, HET = 2).

Carries 0..4 32-bit time values selected by the 16-bit Use bit field. When present they appear in the fixed order SCT-High, SCT-Low, ERT, SLC; each Some value contributes one 32-bit word. The PI-specific low 8 bits of the Use field are preserved verbatim in pi_specific.

Fields§

§sct_high: Option<u32>

Sender Current Time, MS 32 bits (NTP seconds).

§sct_low: Option<u32>

Sender Current Time, LS 32 bits (NTP fraction). If set, sct_high MUST also be set.

§ert: Option<u32>

Expected Residual Time, seconds.

§slc: Option<u32>

Session Last Changed time, seconds.

§pi_specific: u8

PI-specific low 8 bits of the Use field (out of scope of RFC 5651).

Implementations§

Source§

impl ExtTime

Source

pub fn use_field(&self) -> u16

Build the 16-bit Use field from the present values + PI-specific byte.

Source

pub fn serialized_len(&self) -> usize

Total serialized length in bytes (first word + 4 bytes per value).

Source

pub fn parse(content: &[u8]) -> Result<Self>

Decode an EXT_TIME from the content of a HeaderExtension whose HET is HET_EXT_TIME (the content is everything after HET+HEL: the 2-byte Use field followed by the time values).

Source

pub fn to_content(&self) -> Vec<u8>

Encode the EXT_TIME content (Use field + present time values) into a freshly allocated buffer suitable for HeaderExtension::content.

Source

pub fn to_extension<'a>(&self, scratch: &'a mut Vec<u8>) -> HeaderExtension<'a>

Build a generic HeaderExtension (HET = 2) carrying this EXT_TIME, borrowing from scratch (which must outlive the returned extension).

Trait Implementations§

Source§

impl Clone for ExtTime

Source§

fn clone(&self) -> ExtTime

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for ExtTime

Source§

impl Debug for ExtTime

Source§

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

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

impl Default for ExtTime

Source§

fn default() -> ExtTime

Returns the “default value” for a type. Read more
Source§

impl Eq for ExtTime

Source§

impl PartialEq for ExtTime

Source§

fn eq(&self, other: &ExtTime) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for ExtTime

Available on crate feature serde only.
Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for ExtTime

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

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>,

Source§

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.