Struct simple_dns::ResourceRecord
source · pub struct ResourceRecord<'a> {
pub name: Name<'a>,
pub class: CLASS,
pub ttl: u32,
pub rdata: RData<'a>,
pub cache_flush: bool,
}
Expand description
Resource Records are used to represent the answer, authority, and additional sections in DNS packets.
Fields§
§name: Name<'a>
A Name
to which this resource record pertains.
class: CLASS
A CLASS
that defines the class of the rdata field
ttl: u32
The time interval (in seconds) that the resource record may becached before it should be discarded.
Zero values are interpreted to mean that the RR can only be used for the transaction in progress, and should not be cached.
rdata: RData<'a>
A RData
with the contents of this resource record
cache_flush: bool
Indicates if this RR is a cache flush
Implementations§
source§impl<'a> ResourceRecord<'a>
impl<'a> ResourceRecord<'a>
sourcepub fn new(name: Name<'a>, class: CLASS, ttl: u32, rdata: RData<'a>) -> Self
pub fn new(name: Name<'a>, class: CLASS, ttl: u32, rdata: RData<'a>) -> Self
Creates a new ResourceRecord
sourcepub fn with_cache_flush(self, cache_flush: bool) -> Self
pub fn with_cache_flush(self, cache_flush: bool) -> Self
Consume self and change the cache_flush bit
sourcepub fn to_cache_flush_record(&self) -> Self
pub fn to_cache_flush_record(&self) -> Self
Returns a cloned self with cache_flush = true
sourcepub fn match_qclass(&self, qclass: QCLASS) -> bool
pub fn match_qclass(&self, qclass: QCLASS) -> bool
Return true if current resource match given query class
sourcepub fn match_qtype(&self, qtype: QTYPE) -> bool
pub fn match_qtype(&self, qtype: QTYPE) -> bool
Return true if current resource match given query type
sourcepub fn into_owned<'b>(self) -> ResourceRecord<'b>
pub fn into_owned<'b>(self) -> ResourceRecord<'b>
Transforms the inner data into its owned type
Trait Implementations§
source§impl<'a> Clone for ResourceRecord<'a>
impl<'a> Clone for ResourceRecord<'a>
source§fn clone(&self) -> ResourceRecord<'a>
fn clone(&self) -> ResourceRecord<'a>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more