DnsTxt

Struct DnsTxt 

Source
pub struct DnsTxt { /* private fields */ }
Expand description

Resource Record for a DNS TXT record.

From [RFC 6763 section 6]:

The format of each constituent string within the DNS TXT record is a single length byte, followed by 0-255 bytes of text data.

DNS-SD uses DNS TXT records to store arbitrary key/value pairs conveying additional information about the named service. Each key/value pair is encoded as its own constituent string within the DNS TXT record, in the form “key=value” (without the quotation marks). Everything up to the first ‘=’ character is the key (Section 6.4). Everything after the first ‘=’ character to the end of the string (including subsequent ‘=’ characters, if any) is the value

Implementations§

Source§

impl DnsTxt

Source

pub fn new(name: &str, class: u16, ttl: u32, text: Vec<u8>) -> Self

Source

pub fn text(&self) -> &[u8]

Trait Implementations§

Source§

impl Clone for DnsTxt

Source§

fn clone(&self) -> DnsTxt

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DnsTxt

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl DnsRecordExt for DnsTxt

Source§

fn get_record(&self) -> &DnsRecord

Source§

fn get_record_mut(&mut self) -> &mut DnsRecord

Source§

fn write(&self, packet: &mut DnsOutPacket)

Source§

fn any(&self) -> &dyn Any

Source§

fn matches(&self, other: &dyn DnsRecordExt) -> bool

Returns whether other record is considered the same except TTL.
Source§

fn rrdata_match(&self, other: &dyn DnsRecordExt) -> bool

Returns whether other record has the same rdata.
Source§

fn compare_rdata(&self, other: &dyn DnsRecordExt) -> Ordering

Returns the result based on a byte-level comparison of rdata. If other is not valid, returns Greater.
Source§

fn rdata_print(&self) -> String

Returns a human-readable string of rdata.
Source§

fn clone_box(&self) -> DnsRecordBox

Source§

fn compare(&self, other: &dyn DnsRecordExt) -> Ordering

Returns the result based on “lexicographically later” defined below.
Source§

fn get_class(&self) -> u16

Returns the class only, excluding class_flush / unique bit.
Source§

fn get_cache_flush(&self) -> bool

Source§

fn get_name(&self) -> &str

Return the new name if exists, otherwise the regular name in DnsEntry.
Source§

fn get_type(&self) -> RRType

Source§

fn reset_ttl(&mut self, other: &dyn DnsRecordExt)

Resets TTL using other record. self.refresh and self.expires are also reset.
Source§

fn get_created(&self) -> u64

Source§

fn get_expire(&self) -> u64

Source§

fn set_expire(&mut self, expire_at: u64)

Source§

fn set_expire_sooner(&mut self, expire_at: u64)

Set expire as expire_at if it is sooner than the current expire.
Source§

fn updated_refresh_time(&mut self, now: u64) -> Option<u64>

Given now, if the record is due to refresh, this method updates the refresh time and returns the new refresh time. Otherwise, returns None.
Source§

fn suppressed_by_answer(&self, other: &dyn DnsRecordExt) -> bool

Returns true if another record has matched content, and if its TTL is at least half of this record’s.
Source§

fn suppressed_by(&self, msg: &DnsIncoming) -> bool

Required by RFC 6762 Section 7.1: Known-Answer Suppression.

Auto Trait Implementations§

§

impl Freeze for DnsTxt

§

impl RefUnwindSafe for DnsTxt

§

impl Send for DnsTxt

§

impl Sync for DnsTxt

§

impl Unpin for DnsTxt

§

impl UnwindSafe for DnsTxt

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.