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

pub struct ParsedRecord<Ref> { /* fields omitted */ }

A raw record parsed from a message.

A value of this type contains the record header and the raw record data. It is mainly used as an intermediary type when turning raw message data into Records.

It allows access to the header only but can be traded for a real record of a specific type of ParseRecordData (i.e., some type that knowns how to parse record data) via the to_record and into_record methods.

Implementations

impl<Ref> ParsedRecord<Ref>[src]

pub fn new(header: RecordHeader<ParsedDname<Ref>>, data: Parser<Ref>) -> Self[src]

Creates a new parsed record from a header and the record data.

The record data is provided via a parser that is positioned at the first byte of the record data.

pub fn owner(&self) -> &ParsedDname<Ref>[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.

impl<Ref: OctetsRef> ParsedRecord<Ref>[src]

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

Creates a real resource record from the parsed record.

The method is generic over a type that knows how to parse record data via the ParseRecordData trait. The record data is given to this trait for parsing. If the trait feels capable of parsing this type of record (as indicated by the record type) and parsing succeeds, the method returns Ok(Some(_)). It returns Ok(None) if the trait doesn’t know how to parse this particular record type. It returns an error if parsing fails.

pub fn into_record<Data>(
    self
) -> Result<Option<Record<ParsedDname<Ref>, Data>>, ParseError> where
    Data: ParseRecordData<Ref>, 
[src]

Trades the parsed record for a real resource record.

The method is generic over a type that knows how to parse record data via the ParseRecordData trait. The record data is given to this trait for parsing. If the trait feels capable of parsing this type of record (as indicated by the record type) and parsing succeeds, the method returns Ok(Some(_)). It returns Ok(None) if the trait doesn’t know how to parse this particular record type. It returns an error if parsing fails.

Trait Implementations

impl<Ref: Clone> Clone for ParsedRecord<Ref>[src]

impl<Ref: OctetsRef> Eq for ParsedRecord<Ref>[src]

impl<Ref: OctetsRef> Parse<Ref> for ParsedRecord<Ref>[src]

impl<Ref, OtherRef> PartialEq<ParsedRecord<OtherRef>> for ParsedRecord<Ref> where
    Ref: OctetsRef,
    OtherRef: OctetsRef
[src]

Auto Trait Implementations

impl<Ref> RefUnwindSafe for ParsedRecord<Ref> where
    Ref: RefUnwindSafe

impl<Ref> Send for ParsedRecord<Ref> where
    Ref: Send

impl<Ref> Sync for ParsedRecord<Ref> where
    Ref: Sync

impl<Ref> Unpin for ParsedRecord<Ref> where
    Ref: Unpin

impl<Ref> UnwindSafe for ParsedRecord<Ref> where
    Ref: 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>,