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

pub struct Record<Name, Data> { /* fields omitted */ }

A DNS resource record.

All information available through the DNS is stored in resource records. They have a three part key of a domain name, resource record type, and class. Data is arranged in a tree which is navigated using the domain name. Each node in the tree carries a label, starting with the root label as the top-most node. The tree is traversed by stepping through the name from right to left, finding a child node carring the label of each step. The domain name resulting from this traversal is part of the record itself. It is called the owner of the record.

The record type describes the kind of data the record holds, such as IP addresses. The class, finally, describes which sort of network the information is for. The DNS was originally intended to be used for networks other than the Internet as well. In practice, the only relevant class is IN, the Internet. Note that each class has its own tree of nodes.

The payload of a resource record is its data. Its purpose, meaning, and format is determined by the record type (technically, also its class). For each unique three-part key there can be multiple resource records. All these records for the same key are called resource record sets, most often shortened to ‘RRset.’

There is one more piece of data: the TTL or time to live. This value says how long a record remains valid before it should be refreshed from its original source, given in seconds. The TTL is used to add caching facilities to the DNS.

Values of the Record type represent one single resource record. Since there are currently more than eighty record types—see Rtype for a complete list—, the type is generic over a trait for record data. This trait holds both the record type value and the record data as they are inseparably entwined.

Because a record’s owner is a domain name, the Record type is additionally generic over the domain name type is for it.

There is three ways to create a record value. First, you can make one yourself using the new function. It will neatly take care of all the generics through type inference. Secondly, you can parse a record from an existing message. Message and its friends provide a way to do that; see there for all the details. Finally, you can scan a record from master data (aka zonefiles). See the domain::master module for that.

Implementations

impl<Name, Data> Record<Name, Data>[src]

pub fn new(owner: Name, class: Class, ttl: u32, data: Data) -> Self[src]

Creates a new record from its parts.

pub fn from_record<NN, DD>(record: Record<NN, DD>) -> Self where
    Name: From<NN>,
    Data: From<DD>, 
[src]

Creates a new record from a compatible record.

This function only exists because the equivalent From implementation is currently not possible,

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

Returns a reference to the owner domain name.

The owner of a record is the domain name that specifies the node in the DNS tree this record belongs to.

pub fn rtype(&self) -> Rtype where
    Data: RecordData
[src]

Returns the record type.

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

Returns the record class.

pub fn set_class(&mut self, class: Class)[src]

Sets the record’s class.

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

Returns the record’s time-to-live.

pub fn set_ttl(&mut self, ttl: u32)[src]

Sets the record’s time-to-live.

pub fn data(&self) -> &Data[src]

Return a reference to the record data.

pub fn data_mut(&mut self) -> &mut Data[src]

Returns a mutable reference to the record data.

pub fn into_data(self) -> Data[src]

Trades the record for its record data.

Trait Implementations

impl<Name: ToDname, Data: RecordData> AsRecord for Record<Name, Data>[src]

type Name = Name

The type of the record’s owner domain name.

type Data = Data

The type of the record data.

impl<N, NN, D, DD> CanonicalOrd<Record<NN, DD>> for Record<N, D> where
    N: ToDname,
    NN: ToDname,
    D: RecordData + CanonicalOrd<DD>,
    DD: RecordData
[src]

impl<Name: Clone, Data: Clone> Clone for Record<Name, Data>[src]

impl<N: ToDname, D: RecordData> Compose for Record<N, D>[src]

impl<Name, Data> Debug for Record<Name, Data> where
    Name: Debug,
    Data: Debug
[src]

impl<Name, Data> Display for Record<Name, Data> where
    Name: Display,
    Data: RecordData + Display
[src]

impl<N: Eq, D: RecordData + Eq> Eq for Record<N, D>[src]

impl<N, D> From<(N, Class, u32, D)> for Record<N, D>[src]

impl<N, D> From<(N, u32, D)> for Record<N, D>[src]

impl<Octets, N: ToDname> From<Record<N, Opt<Octets>>> for OptRecord<Octets>[src]

impl<Name, Data> Hash for Record<Name, Data> where
    Name: Hash,
    Data: Hash
[src]

impl<N, D> Ord for Record<N, D> where
    N: Ord,
    D: RecordData + Ord
[src]

impl<N, NN, D, DD> PartialEq<Record<NN, DD>> for Record<N, D> where
    N: PartialEq<NN>,
    D: RecordData + PartialEq<DD>,
    DD: RecordData
[src]

impl<N, NN, D, DD> PartialOrd<Record<NN, DD>> for Record<N, D> where
    N: PartialOrd<NN>,
    D: RecordData + PartialOrd<DD>,
    DD: RecordData
[src]

Auto Trait Implementations

impl<Name, Data> RefUnwindSafe for Record<Name, Data> where
    Data: RefUnwindSafe,
    Name: RefUnwindSafe

impl<Name, Data> Send for Record<Name, Data> where
    Data: Send,
    Name: Send

impl<Name, Data> Sync for Record<Name, Data> where
    Data: Sync,
    Name: Sync

impl<Name, Data> Unpin for Record<Name, Data> where
    Data: Unpin,
    Name: Unpin

impl<Name, Data> UnwindSafe for Record<Name, Data> where
    Data: UnwindSafe,
    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> ToString for T where
    T: Display + ?Sized
[src]

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