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
.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>
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>
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>
source§impl<Octs, Other> PartialOrd<Txt<Other>> for Txt<Octs>
impl<Octs, Other> PartialOrd<Txt<Other>> for Txt<Octs>
source§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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)