[][src]Struct domain::base::record::RecordHeader

pub struct RecordHeader<Name> { /* fields omitted */ }

The header of a resource record.

This type encapsulates the common header of a resource record. It consists of the owner, record type, class, TTL, and the length of the record data. It is effectively a helper type for dealing with resource records encoded in a DNS message.

See Record for more details about resource records.

Implementations

impl<Name> RecordHeader<Name>[src]

pub fn new(
    owner: Name,
    rtype: Rtype,
    class: Class,
    ttl: u32,
    rdlen: u16
) -> Self
[src]

Creates a new record header from its components.

impl<Name> RecordHeader<Name>[src]

pub fn parse_and_skip<Ref>(parser: &mut Parser<Ref>) -> Result<Self, ParseError> where
    Self: Parse<Ref>,
    Ref: OctetsRef
[src]

Parses a record header and then skips over the data.

If the function succeeds, the parser will be positioned right behind the end of the record.

impl<Ref: OctetsRef> RecordHeader<ParsedDname<Ref>>[src]

pub fn parse_into_record<Data>(
    self,
    parser: &mut Parser<Ref>
) -> Result<Option<Record<ParsedDname<Ref>, Data>>, ParseError> where
    Data: ParseRecordData<Ref>, 
[src]

Parses the remainder of the record and returns it.

The method assumes that the parsers is currently positioned right after the end of the record header. If the record data type D feels capable of parsing a record with a header of self, the method will parse the data and return a full Record<D>. Otherwise, it skips over the record data.

impl<Name> RecordHeader<Name>[src]

pub fn owner(&self) -> &Name[src]

Returns a reference to the owner of the record.

pub fn rtype(&self) -> Rtype[src]

Returns the record type of the record.

pub fn class(&self) -> Class[src]

Returns the class of the record.

pub fn ttl(&self) -> u32[src]

Returns the TTL of the record.

pub fn rdlen(&self) -> u16[src]

Returns the data length of the record.

pub fn into_record<Data>(self, data: Data) -> Record<Name, Data>[src]

Converts the header into an actual record.

Trait Implementations

impl<Name: Clone> Clone for RecordHeader<Name>[src]

impl<Name: Compose> Compose for RecordHeader<Name>[src]

impl<Name: Debug> Debug for RecordHeader<Name>[src]

impl<Name: ToDname> Eq for RecordHeader<Name>[src]

impl<Name: Hash> Hash for RecordHeader<Name>[src]

impl<Name: ToDname> Ord for RecordHeader<Name>[src]

impl<Ref: OctetsRef> Parse<Ref> for RecordHeader<ParsedDname<Ref>>[src]

impl<Name, NName> PartialEq<RecordHeader<NName>> for RecordHeader<Name> where
    Name: ToDname,
    NName: ToDname
[src]

impl<Name, NName> PartialOrd<RecordHeader<NName>> for RecordHeader<Name> where
    Name: ToDname,
    NName: ToDname
[src]

Auto Trait Implementations

impl<Name> RefUnwindSafe for RecordHeader<Name> where
    Name: RefUnwindSafe

impl<Name> Send for RecordHeader<Name> where
    Name: Send

impl<Name> Sync for RecordHeader<Name> where
    Name: Sync

impl<Name> Unpin for RecordHeader<Name> where
    Name: Unpin

impl<Name> UnwindSafe for RecordHeader<Name> where
    Name: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,