pub struct Txt<Octs: ?Sized>(_);
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>where
<Octs as FromBuilder>::Builder: EmptyBuilder + AsRef<[u8]> + AsMut<[u8]>,
pub fn build_from_slice(text: &[u8]) -> Result<Self, ShortBuf>where <Octs as FromBuilder>::Builder: EmptyBuilder + AsRef<[u8]> + AsMut<[u8]>,
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>where
<T as FromBuilder>::Builder: EmptyBuilder,
pub fn try_text<T: FromBuilder>( &self ) -> Result<T, <<T as FromBuilder>::Builder as OctetsBuilder>::AppendError>where <T as FromBuilder>::Builder: EmptyBuilder,
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>,
source§impl<SrcOcts> Txt<SrcOcts>
impl<SrcOcts> Txt<SrcOcts>
pub fn flatten_into<Octs>(self) -> Result<Txt<Octs>, PushError>where Octs: OctetsFrom<SrcOcts>,
Trait Implementations§
source§impl<Octs, Other> CanonicalOrd<Txt<Other>> for Txt<Octs>where
Octs: AsRef<[u8]>,
Other: AsRef<[u8]>,
impl<Octs, Other> CanonicalOrd<Txt<Other>> for Txt<Octs>where Octs: AsRef<[u8]>, Other: AsRef<[u8]>,
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>>where
Octs: Octets + ?Sized,
impl<'a, Octs> ParseRecordData<'a, Octs> for Txt<Octs::Range<'a>>where Octs: Octets + ?Sized,
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>where
Octs: AsRef<[u8]>,
Other: AsRef<[u8]>,
impl<Octs, Other> PartialEq<Txt<Other>> for Txt<Octs>where Octs: AsRef<[u8]>, Other: AsRef<[u8]>,
source§impl<Octs, Other> PartialOrd<Txt<Other>> for Txt<Octs>where
Octs: AsRef<[u8]>,
Other: AsRef<[u8]>,
impl<Octs, Other> PartialOrd<Txt<Other>> for Txt<Octs>where Octs: AsRef<[u8]>, Other: AsRef<[u8]>,
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: ?Sized> RefUnwindSafe for Txt<Octs>where Octs: RefUnwindSafe,
impl<Octs: ?Sized> Send for Txt<Octs>where Octs: Send,
impl<Octs: ?Sized> Sync for Txt<Octs>where Octs: Sync,
impl<Octs: ?Sized> Unpin for Txt<Octs>where Octs: Unpin,
impl<Octs: ?Sized> UnwindSafe for Txt<Octs>where Octs: UnwindSafe,
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) -> Targetwhere
Self::Error: Into<Infallible>,
fn octets_into(self) -> Targetwhere Self::Error: Into<Infallible>,
Performs an infallible conversion.