pub struct TXT { /* private fields */ }
Expand description
RFC 1035, DOMAIN NAMES - IMPLEMENTATION AND SPECIFICATION, November 1987
3.3.14. TXT RDATA format
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
/ TXT-DATA /
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
TXT RRs are used to hold descriptive text. The semantics of the text
depends on the domain where it is found.
Implementations
sourceimpl TXT
impl TXT
sourcepub fn new(txt_data: Vec<String>) -> Self
pub fn new(txt_data: Vec<String>) -> Self
Creates a new TXT record data.
Arguments
txt_data
- the set of strings which make up the txt_data.
Return value
The new TXT record data.
sourcepub fn from_bytes(txt_data: Vec<&[u8]>) -> Self
pub fn from_bytes(txt_data: Vec<&[u8]>) -> Self
Creates a new TXT record data from bytes. Allows creating binary record data.
Arguments
txt_data
- the set of bytes which make up the txt_data.
Return value
The new TXT record data.
Trait Implementations
sourceimpl<'de> Deserialize<'de> for TXT
impl<'de> Deserialize<'de> for TXT
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl Display for TXT
impl Display for TXT
sourcefn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>
Format a TXT with lossy conversion of invalid utf8.
Case of invalid utf8
Invalid utf8 will be converted to:
U+FFFD REPLACEMENT CHARACTER
, which looks like this: �
Same behaviour as alloc::string::String::from_utf8_lossy
.
let first_bytes = b"Invalid utf8 <\xF0\x90\x80>.";
let second_bytes = b" Valid utf8 <\xF0\x9F\xA4\xA3>";
let rdata: Vec<&[u8]> = vec![first_bytes, second_bytes];
let txt = TXT::from_bytes(rdata);
let tested = format!("{}", txt);
assert_eq!(
tested.as_bytes(),
b"Invalid utf8 <\xEF\xBF\xBD>. Valid utf8 <\xF0\x9F\xA4\xA3>",
"Utf8 lossy conversion error! Mismatch between input and expected"
);
sourceimpl PartialEq<TXT> for TXT
impl PartialEq<TXT> for TXT
impl Eq for TXT
impl StructuralEq for TXT
impl StructuralPartialEq for TXT
Auto Trait Implementations
impl RefUnwindSafe for TXT
impl Send for TXT
impl Sync for TXT
impl Unpin for TXT
impl UnwindSafe for TXT
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more