Struct trust_dns_proto::rr::RecordSet
source · [−]pub struct RecordSet { /* private fields */ }
Expand description
Set of resource records associated to a name and type
Implementations
sourceimpl RecordSet
impl RecordSet
sourcepub fn new(name: &Name, record_type: RecordType, serial: u32) -> Self
pub fn new(name: &Name, record_type: RecordType, serial: u32) -> Self
Creates a new Resource Record Set.
Arguments
name
- The label for theRecordSet
record_type
-RecordType
of thisRecordSet
, all records in theRecordSet
must be of the specifiedRecordType
.serial
- current serial number of theSOA
record, this is to be used forIXFR
and signing for DNSSec after updates.
Return value
The newly created Resource Record Set TODO: make all cloned params pass by value
sourcepub fn with_ttl(name: Name, record_type: RecordType, ttl: u32) -> Self
pub fn with_ttl(name: Name, record_type: RecordType, ttl: u32) -> Self
Creates a new Resource Record Set.
Arguments
name
- The label for theRecordSet
record_type
-RecordType
of thisRecordSet
, all records in theRecordSet
must be of the specifiedRecordType
.ttl
- time-to-live for theRecordSet
in seconds.
Return value
The newly created Resource Record Set TODO: make all cloned params pass by value
sourcepub fn name(&self) -> &Name
pub fn name(&self) -> &Name
Return value
Label of the Resource Record Set
sourcepub fn record_type(&self) -> RecordType
pub fn record_type(&self) -> RecordType
Return value
RecordType
of the Resource Record Set
sourcepub fn set_dns_class(&mut self, dns_class: DNSClass)
pub fn set_dns_class(&mut self, dns_class: DNSClass)
Sets the DNSClass to the specified value
This will traverse every record and associate with it the specified dns_class
sourcepub fn set_ttl(&mut self, ttl: u32)
pub fn set_ttl(&mut self, ttl: u32)
Sets the TTL, in seconds, to the specified value
This will traverse every record and associate with it the specified ttl
sourcepub fn ttl(&self) -> u32
pub fn ttl(&self) -> u32
Returns the time-to-live for the record.
Return value
TTL, time-to-live, of the Resource Record Set, this is the maximum length of time that an RecordSet should be cached.
sourcepub fn records(
&self,
and_rrsigs: bool,
supported_algorithms: SupportedAlgorithms
) -> RrsetRecords<'_>ⓘNotable traits for RrsetRecords<'r>impl<'r> Iterator for RrsetRecords<'r> type Item = &'r Record;
This is supported on crate feature dnssec
only.
pub fn records(
&self,
and_rrsigs: bool,
supported_algorithms: SupportedAlgorithms
) -> RrsetRecords<'_>ⓘNotable traits for RrsetRecords<'r>impl<'r> Iterator for RrsetRecords<'r> type Item = &'r Record;
dnssec
only.Returns a Vec of all records in the set.
Arguments
and_rrsigs
- if true, RRSIGs will be returned if they existsupported_algorithms
- the RRSIGs will be filtered by the set of supported_algorithms, and then only the maximal RRSIG algorithm will be returned.
sourcepub fn records_with_rrsigs(
&self,
supported_algorithms: SupportedAlgorithms
) -> RrsetRecords<'_>ⓘNotable traits for RrsetRecords<'r>impl<'r> Iterator for RrsetRecords<'r> type Item = &'r Record;
This is supported on crate feature dnssec
only.
pub fn records_with_rrsigs(
&self,
supported_algorithms: SupportedAlgorithms
) -> RrsetRecords<'_>ⓘNotable traits for RrsetRecords<'r>impl<'r> Iterator for RrsetRecords<'r> type Item = &'r Record;
dnssec
only.Returns a Vec of all records in the set, with RRSIGs, if present.
Arguments
supported_algorithms
- the RRSIGs will be filtered by the set of supported_algorithms, and then only the maximal RRSIG algorithm will be returned.
sourcepub fn records_without_rrsigs(&self) -> RrsetRecords<'_>ⓘNotable traits for RrsetRecords<'r>impl<'r> Iterator for RrsetRecords<'r> type Item = &'r Record;
pub fn records_without_rrsigs(&self) -> RrsetRecords<'_>ⓘNotable traits for RrsetRecords<'r>impl<'r> Iterator for RrsetRecords<'r> type Item = &'r Record;
Returns a Vec of all records in the set, without any RRSIGs.
sourcepub fn iter(&self) -> Iter<'_, Record>
👎 Deprecated: see records_without_rrsigs
pub fn iter(&self) -> Iter<'_, Record>
see records_without_rrsigs
Returns an iterator over the records in the set
sourcepub fn rrsigs(&self) -> &[Record]
pub fn rrsigs(&self) -> &[Record]
Returns a slice of all the Records signatures in the RecordSet
sourcepub fn insert_rrsig(&mut self, rrsig: Record)
pub fn insert_rrsig(&mut self, rrsig: Record)
Inserts a Signature for the Record set
Many can be associated with the RecordSet. Once added, the RecordSet should not be changed
Arguments
rrsig
- A signature which covers the RecordSet.
sourcepub fn clear_rrsigs(&mut self)
pub fn clear_rrsigs(&mut self)
Useful for clearing all signatures when the RecordSet is updated, or keys are rotated.
sourcepub fn new_record(&mut self, rdata: &RData) -> &Record
pub fn new_record(&mut self, rdata: &RData) -> &Record
creates a new Record as part of this RecordSet, adding the associated RData
this interface may be deprecated in the future.
sourcepub fn add_rdata(&mut self, rdata: RData) -> bool
pub fn add_rdata(&mut self, rdata: RData) -> bool
creates a new Record as part of this RecordSet, adding the associated RData
sourcepub fn insert(&mut self, record: Record, serial: u32) -> bool
pub fn insert(&mut self, record: Record, serial: u32) -> bool
Inserts a new Resource Record into the Set.
If the record is inserted, the ttl for the most recent record will be used for the ttl of the entire resource record set.
This abides by the following restrictions in RFC 2136, April 1997:
1.1.5. The following RR types cannot be appended to an RRset. If the
following comparison rules are met, then an attempt to add the new RR
will result in the replacement of the previous RR:
SOA compare only NAME, CLASS and TYPE -- it is not possible to
have more than one SOA per zone, even if any of the data
fields differ.
CNAME compare only NAME, CLASS, and TYPE -- it is not possible
to have more than one CNAME RR, even if their data fields
differ.
Arguments
record
-Record
asserts that thename
andrecord_type
match theRecordSet
.serial
- current serial number of theSOA
record, this is to be used forIXFR
and signing for DNSSec after updates. The serial will only be updated if the record was added.
Return value
True if the record was inserted.
TODO: make a default add without serial number for basic usage
sourcepub fn remove(&mut self, record: &Record, serial: u32) -> bool
pub fn remove(&mut self, record: &Record, serial: u32) -> bool
Removes the Resource Record if it exists.
Arguments
record
-Record
asserts that thename
andrecord_type
match theRecordSet
. Removes anyrecord
if the record data,RData
, match.serial
- current serial number of theSOA
record, this is to be used forIXFR
and signing for DNSSec after updates. The serial will only be updated if the record was added.
Return value
True if a record was removed.
sourcepub fn into_parts(self) -> RecordSetParts
pub fn into_parts(self) -> RecordSetParts
Consumes RecordSet
and returns its components
Trait Implementations
sourceimpl IntoIterator for RecordSet
impl IntoIterator for RecordSet
sourceimpl IntoRecordSet for RecordSet
impl IntoRecordSet for RecordSet
sourcefn into_record_set(self) -> Self
fn into_record_set(self) -> Self
use From/Into
Performs the conversion to a RecordSet
impl StructuralPartialEq for RecordSet
Auto Trait Implementations
impl RefUnwindSafe for RecordSet
impl Send for RecordSet
impl Sync for RecordSet
impl Unpin for RecordSet
impl UnwindSafe for RecordSet
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more