Struct domain::base::message::RecordSection[][src]

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

An iterator over the records in one of the three record sections.

The iterator’s item is the result of parsing a raw record represented by ParsedRecord. This type will allow access to an unparsed record. It can be converted into a concrete Record via its into_record method. If parsing the raw record fails, the iterator will return an error once and None after that.

Alternatively, you can trade in a value of this type into a RecordIter that iterates over Records of a specific type by calling the limit_to method. In particular, you can use this together with AllRecordData to acquire an iterator that parses all known record types.

RecordSection values cannot be created directly. You can get one either by calling the method for the section in question of a Message value or by proceeding from another section via its next_section method.

Implementations

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

pub fn pos(&self) -> usize[src]

Returns the current position relative to the beginning of the message.

pub fn limit_to<Data: ParseRecordData<Ref>>(self) -> RecordIter<Ref, Data>

Notable traits for RecordIter<Ref, Data>

impl<Ref, Data> Iterator for RecordIter<Ref, Data> where
    Ref: OctetsRef,
    Data: ParseRecordData<Ref>, 
type Item = Result<Record<ParsedDname<Ref>, Data>, ParseError>;
[src]

Trades self in for an iterator limited to a concrete record type.

The record type is given through its record data type. Since the data is being parsed, this type must implement ParseRecordData. For record data types that are generic over domain name types, this is normally achieved by giving them a ParsedDname. As a convenience, type aliases for all the fundamental record data types exist in the domain::rdata::parsed module.

The returned limited iterator will continue at the current position of self. It will not start from the beginning of the section.

pub fn limit_to_in<Data: ParseRecordData<Ref>>(self) -> RecordIter<Ref, Data>

Notable traits for RecordIter<Ref, Data>

impl<Ref, Data> Iterator for RecordIter<Ref, Data> where
    Ref: OctetsRef,
    Data: ParseRecordData<Ref>, 
type Item = Result<Record<ParsedDname<Ref>, Data>, ParseError>;
[src]

Trades self in for an iterator limited to a type in IN class.

Behaves exactly like limit_to but skips over records that are not of class IN.

pub fn next_section(self) -> Result<Option<Self>, ParseError>[src]

Proceeds to the next section if there is one.

Returns an error if parsing has failed and the message is unusable now.

Trait Implementations

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

impl<Ref: Copy> Copy for RecordSection<Ref>[src]

impl<Ref: Debug> Debug for RecordSection<Ref>[src]

impl<Ref: OctetsRef> Iterator for RecordSection<Ref>[src]

type Item = Result<ParsedRecord<Ref>, ParseError>

The type of the elements being iterated over.

Auto Trait Implementations

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

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

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

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

impl<Ref> UnwindSafe for RecordSection<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<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<I> IteratorRandom for I where
    I: Iterator
[src]

impl<Source, Target> OctetsInto<Target> for Source where
    Target: OctetsFrom<Source>, 
[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>,