pub struct TxtProperties { /* private fields */ }Expand description
Represents properties in a TXT record.
The key string of a property is case insensitive, and only
one TxtProperty is stored for the same key.
RFC 6763: “A given key SHOULD NOT appear more than once in a TXT record.”
Implementations§
Source§impl TxtProperties
impl TxtProperties
pub fn new() -> Self
Sourcepub fn iter(&self) -> impl Iterator<Item = &TxtProperty>
pub fn iter(&self) -> impl Iterator<Item = &TxtProperty>
Returns an iterator for all properties.
Sourcepub fn get(&self, key: &str) -> Option<&TxtProperty>
pub fn get(&self, key: &str) -> Option<&TxtProperty>
Returns a property for a given key, where key is
case insensitive.
Sourcepub fn get_property_val(&self, key: &str) -> Option<Option<&[u8]>>
pub fn get_property_val(&self, key: &str) -> Option<Option<&[u8]>>
Returns a property value for a given key, where key is
case insensitive.
Returns None if key does not exist.
Returns Some(Option<&u8>) for its value.
Sourcepub fn get_property_val_str(&self, key: &str) -> Option<&str>
pub fn get_property_val_str(&self, key: &str) -> Option<&str>
Returns a property value string for a given key, where key is
case insensitive.
Returns None if key does not exist.
Returns Some("") if its value is None or is empty.
Sourcepub fn into_property_map_str(self) -> HashMap<String, String>
pub fn into_property_map_str(self) -> HashMap<String, String>
Consumes properties and returns a hashmap, where the keys are the properties keys.
If a property value is empty, return an empty string (because RFC 6763 allows empty values). If a property value is non-empty but not valid UTF-8, skip the property and log a message.
Trait Implementations§
Source§impl Clone for TxtProperties
impl Clone for TxtProperties
Source§fn clone(&self) -> TxtProperties
fn clone(&self) -> TxtProperties
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TxtProperties
impl Debug for TxtProperties
Source§impl Default for TxtProperties
impl Default for TxtProperties
Source§impl Display for TxtProperties
impl Display for TxtProperties
impl Eq for TxtProperties
Source§impl From<&[u8]> for TxtProperties
impl From<&[u8]> for TxtProperties
Source§impl PartialEq for TxtProperties
impl PartialEq for TxtProperties
Source§fn eq(&self, other: &TxtProperties) -> bool
fn eq(&self, other: &TxtProperties) -> bool
self and other values to be equal, and is used by ==.