Skip to main content

EntryView

Struct EntryView 

Source
pub struct EntryView<'a>(/* private fields */);
Expand description

Zero-copy view into a 16-byte SD entry in a buffer.

Wire layout (16 bytes total):

  • [0]: entry type
  • [1]: index_first_options_run
  • [2]: index_second_options_run
  • [3]: options_count (packed nibbles)
  • [4..6]: service_id (BE)
  • [6..8]: instance_id (BE)
  • [8]: major_version
  • [9..12]: ttl (24-bit BE)
  • [12..16]: minor_version (BE) for service entries, OR [12..14] counter + [14..16] event_group_id for eventgroup entries

Implementations§

Source§

impl EntryView<'_>

Source

pub fn entry_type(&self) -> Result<EntryType, Error>

Returns the entry type.

§Errors

Returns Error::InvalidEntryType if the type byte is not recognized.

Source

pub fn index_first_options_run(&self) -> u8

Returns the index of the first options run.

Source

pub fn index_second_options_run(&self) -> u8

Returns the index of the second options run.

Source

pub fn options_count(&self) -> OptionsCount

Returns the packed options count.

Source

pub fn service_id(&self) -> u16

Returns the service ID.

Source

pub fn instance_id(&self) -> u16

Returns the instance ID.

Source

pub fn major_version(&self) -> u8

Returns the major version.

Source

pub fn ttl(&self) -> u32

Returns the TTL (24-bit value).

Source

pub fn minor_version(&self) -> u32

Minor version (only valid for service entries).

Source

pub fn counter(&self) -> u16

Counter field (only valid for eventgroup entries). Masked to lower 4 bits.

Source

pub fn event_group_id(&self) -> u16

Event group ID (only valid for eventgroup entries).

Source

pub fn to_owned(&self) -> Result<Entry, Error>

Converts this view into an owned Entry.

§Errors

Returns Error::InvalidEntryType if the entry type byte is not recognized.

Trait Implementations§

Source§

impl<'a> Clone for EntryView<'a>

Source§

fn clone(&self) -> EntryView<'a>

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for EntryView<'a>

Source§

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

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

impl<'a> Copy for EntryView<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for EntryView<'a>

§

impl<'a> RefUnwindSafe for EntryView<'a>

§

impl<'a> Send for EntryView<'a>

§

impl<'a> Sync for EntryView<'a>

§

impl<'a> Unpin for EntryView<'a>

§

impl<'a> UnsafeUnpin for EntryView<'a>

§

impl<'a> UnwindSafe for EntryView<'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> 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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more