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<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
Returns the canonical ordering between
self
and other
.source§fn canonical_lt(&self, other: &Rhs) -> bool
fn canonical_lt(&self, other: &Rhs) -> bool
Returns whether
self
is canonically less than other
.source§fn canonical_le(&self, other: &Rhs) -> bool
fn canonical_le(&self, other: &Rhs) -> bool
Returns whether
self
is canonically less than or equal to other
.source§fn canonical_gt(&self, other: &Rhs) -> bool
fn canonical_gt(&self, other: &Rhs) -> bool
Returns whether
self
is canonically greater than other
.source§fn canonical_ge(&self, other: &Rhs) -> bool
fn canonical_ge(&self, other: &Rhs) -> bool
Returns whether
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>
Returns the length of the record data if available. Read more
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>
Appends the wire format of the record data into
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>
Appends the canonical wire format of the record data into
target
.source§fn compose_len_rdata<Target: Composer + ?Sized>(
&self,
target: &mut Target,
) -> Result<(), Target::AppendError>
fn compose_len_rdata<Target: Composer + ?Sized>( &self, target: &mut Target, ) -> Result<(), Target::AppendError>
Appends the record data prefixed with its length.
source§fn compose_canonical_len_rdata<Target: Composer + ?Sized>(
&self,
target: &mut Target,
) -> Result<(), Target::AppendError>
fn compose_canonical_len_rdata<Target: Composer + ?Sized>( &self, target: &mut Target, ) -> Result<(), Target::AppendError>
Appends the record data prefixed with its length.
source§impl<O, N> From<Txt<O>> for AllRecordData<O, N>
impl<O, N> From<Txt<O>> for AllRecordData<O, N>
source§impl<O, N> From<Txt<O>> for ZoneRecordData<O, N>
impl<O, N> From<Txt<O>> for ZoneRecordData<O, N>
source§impl<Octs, SrcOcts> OctetsFrom<Txt<SrcOcts>> for Txt<Octs>where
Octs: OctetsFrom<SrcOcts>,
impl<Octs, SrcOcts> OctetsFrom<Txt<SrcOcts>> for Txt<Octs>where
Octs: OctetsFrom<SrcOcts>,
type Error = <Octs as OctetsFrom<SrcOcts>>::Error
source§impl<Octs: AsRef<[u8]>> Ord for Txt<Octs>
impl<Octs: AsRef<[u8]>> Ord for Txt<Octs>
source§impl<'a, Octs> ParseRecordData<'a, Octs> for Txt<Octs::Range<'a>>
impl<'a, Octs> ParseRecordData<'a, Octs> for Txt<Octs::Range<'a>>
source§fn parse_rdata(
rtype: Rtype,
parser: &mut Parser<'a, Octs>,
) -> Result<Option<Self>, ParseError>
fn parse_rdata( rtype: Rtype, parser: &mut Parser<'a, Octs>, ) -> Result<Option<Self>, ParseError>
Parses the record data. Read more
source§impl<Octs, Other> PartialEq<Txt<Other>> for Txt<Octs>
impl<Octs, Other> PartialEq<Txt<Other>> for Txt<Octs>
source§impl<Octs, Other> PartialOrd<Txt<Other>> for Txt<Octs>
impl<Octs, Other> PartialOrd<Txt<Other>> for Txt<Octs>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl<Octs> RecordData for Txt<Octs>
impl<Octs> RecordData for Txt<Octs>
impl<Octs: AsRef<[u8]>> Eq for Txt<Octs>
Auto Trait Implementations§
impl<Octs> Freeze for Txt<Octs>
impl<Octs> RefUnwindSafe for Txt<Octs>where
Octs: RefUnwindSafe + ?Sized,
impl<Octs> Send for Txt<Octs>
impl<Octs> Sync for Txt<Octs>
impl<Octs> Unpin for Txt<Octs>
impl<Octs> UnwindSafe for Txt<Octs>where
Octs: UnwindSafe + ?Sized,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<Source, Target> OctetsInto<Target> for Sourcewhere
Target: OctetsFrom<Source>,
impl<Source, Target> OctetsInto<Target> for Sourcewhere
Target: OctetsFrom<Source>,
type Error = <Target as OctetsFrom<Source>>::Error
source§fn try_octets_into(
self,
) -> Result<Target, <Source as OctetsInto<Target>>::Error>
fn try_octets_into( self, ) -> Result<Target, <Source as OctetsInto<Target>>::Error>
Performs the conversion.
source§fn octets_into(self) -> Target
fn octets_into(self) -> Target
Performs an infallible conversion.