pub struct Txt<Octs: ?Sized>(/* private fields */);
Expand description
Txt record data.
Txt records hold descriptive text.
The Txt record type is defined in RFC 1035, section 3.3.14.
Implementations§
Source§impl<Octs: FromBuilder> Txt<Octs>
impl<Octs: FromBuilder> Txt<Octs>
Sourcepub fn build_from_slice(text: &[u8]) -> Result<Self, ShortBuf>
pub fn build_from_slice(text: &[u8]) -> Result<Self, ShortBuf>
Creates a new Txt record from a single character string.
Source§impl Txt<[u8]>
impl Txt<[u8]>
Sourcepub fn from_slice(slice: &[u8]) -> Result<&Self, TxtError>
pub fn from_slice(slice: &[u8]) -> Result<&Self, TxtError>
Creates new TXT record data on an octets slice.
Source§impl<Octs: AsRef<[u8]> + ?Sized> Txt<Octs>
impl<Octs: AsRef<[u8]> + ?Sized> Txt<Octs>
Sourcepub fn iter(&self) -> TxtIter<'_> ⓘ
pub fn iter(&self) -> TxtIter<'_> ⓘ
Returns an iterator over the text items.
The Txt format contains one or more length-delimited byte strings. This method returns an iterator over each of them.
pub fn iter_char_strs(&self) -> TxtCharStrIter<'_> ⓘ
Sourcepub fn as_flat_slice(&self) -> Option<&[u8]>
pub fn as_flat_slice(&self) -> Option<&[u8]>
Returns the content if it consists of a single character string.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn try_text<T: FromBuilder>(
&self,
) -> Result<T, <<T as FromBuilder>::Builder as OctetsBuilder>::AppendError>
pub fn try_text<T: FromBuilder>( &self, ) -> Result<T, <<T as FromBuilder>::Builder as OctetsBuilder>::AppendError>
Returns the text content.
If the data is only one single character string, returns a simple clone of the slice with the data. If there are several character strings, their content will be copied together into one single, newly allocated bytes value.
Access to the individual character strings is possible via iteration.
pub fn text<T: FromBuilder>(&self) -> Twhere
<T as FromBuilder>::Builder: EmptyBuilder,
<<T as FromBuilder>::Builder as OctetsBuilder>::AppendError: Into<Infallible>,
Trait Implementations§
Source§impl<Octs, Other> CanonicalOrd<Txt<Other>> for Txt<Octs>
impl<Octs, Other> CanonicalOrd<Txt<Other>> for Txt<Octs>
Source§fn canonical_cmp(&self, other: &Txt<Other>) -> Ordering
fn canonical_cmp(&self, other: &Txt<Other>) -> Ordering
self
and other
.Source§fn canonical_lt(&self, other: &Rhs) -> bool
fn canonical_lt(&self, other: &Rhs) -> bool
self
is canonically less than other
.Source§fn canonical_le(&self, other: &Rhs) -> bool
fn canonical_le(&self, other: &Rhs) -> bool
self
is canonically less than or equal to other
.Source§fn canonical_gt(&self, other: &Rhs) -> bool
fn canonical_gt(&self, other: &Rhs) -> bool
self
is canonically greater than other
.Source§fn canonical_ge(&self, other: &Rhs) -> bool
fn canonical_ge(&self, other: &Rhs) -> bool
self
is canonically greater than or equal to other
.Source§impl<Octs: AsRef<[u8]>> ComposeRecordData for Txt<Octs>
impl<Octs: AsRef<[u8]>> ComposeRecordData for Txt<Octs>
Source§fn rdlen(&self, _compress: bool) -> Option<u16>
fn rdlen(&self, _compress: bool) -> Option<u16>
Source§fn compose_rdata<Target: Composer + ?Sized>(
&self,
target: &mut Target,
) -> Result<(), Target::AppendError>
fn compose_rdata<Target: Composer + ?Sized>( &self, target: &mut Target, ) -> Result<(), Target::AppendError>
target
.Source§fn compose_canonical_rdata<Target: Composer + ?Sized>(
&self,
target: &mut Target,
) -> Result<(), Target::AppendError>
fn compose_canonical_rdata<Target: Composer + ?Sized>( &self, target: &mut Target, ) -> Result<(), Target::AppendError>
target
.