pub struct TXT<'a> { /* private fields */ }Expand description
Represents a TXT Resource Record
Implementations§
Source§impl<'a> TXT<'a>
impl<'a> TXT<'a>
Sourcepub fn add_string(&mut self, char_string: &'a str) -> Result<()>
pub fn add_string(&mut self, char_string: &'a str) -> Result<()>
Add char_string to this TXT record as a validated CharacterString
Sourcepub fn add_char_string(&mut self, char_string: CharacterString<'a>)
pub fn add_char_string(&mut self, char_string: CharacterString<'a>)
Add char_string to this TXT record
Sourcepub fn with_string(self, char_string: &'a str) -> Result<Self>
pub fn with_string(self, char_string: &'a str) -> Result<Self>
Add char_string to this TXT record as a validated CharacterString, consuming and returning Self
Sourcepub fn with_char_string(self, char_string: CharacterString<'a>) -> Self
pub fn with_char_string(self, char_string: CharacterString<'a>) -> Self
Add char_string to this TXT record, consuming and returning Self
Sourcepub fn iter_raw(&self) -> impl Iterator<Item = (&[u8], Option<&[u8]>)>
pub fn iter_raw(&self) -> impl Iterator<Item = (&[u8], Option<&[u8]>)>
Returns parsed attributes from this TXT Record as bytes, valid formats are:
- key=value
- key=
- key
Sourcepub fn add_attribute(&mut self, key: &str, value: Option<&[u8]>) -> Result<()>
pub fn add_attribute(&mut self, key: &str, value: Option<&[u8]>) -> Result<()>
Add a key/value attribute to this TXT record per RFC 6763 Section 6.
The key must be non-empty printable US-ASCII (0x20..=0x7E) excluding =.
The optional value may contain arbitrary binary bytes, as long as the combined
key=value fits within a 255-byte CharacterString.
Sourcepub fn with_attribute(self, key: &str, value: Option<&[u8]>) -> Result<Self>
pub fn with_attribute(self, key: &str, value: Option<&[u8]>) -> Result<Self>
Add a key/value attribute to this TXT record, consuming and returning Self.
Sourcepub fn attributes(&self) -> HashMap<String, Option<String>>
pub fn attributes(&self) -> HashMap<String, Option<String>>
Returns parsed attributes from this TXT Record, valid formats are:
- key=value
- key=
- key
If a key is duplicated, only the first one will be considered (case-insensitive per RFC 6763 Section 6.4)
Sourcepub fn long_attributes(self) -> Result<HashMap<String, Option<String>>>
pub fn long_attributes(self) -> Result<HashMap<String, Option<String>>>
Similar to attributes() but it parses the full TXT record as a single string,
instead of expecting each attribute to be a separate CharacterString
Sourcepub fn into_owned<'b>(self) -> TXT<'b>
pub fn into_owned<'b>(self) -> TXT<'b>
Transforms the inner data into its owned type