pub struct TxtRecord { /* private fields */ }alloc only.Expand description
A DNS-SD TXT record: ordered keys, each with a value or none.
Keys compare case-insensitively and are unique: the first occurrence of a key wins (RFC 6763 section 6.4). Values are bytes.
Implementations§
Source§impl TxtRecord
impl TxtRecord
Sourcepub fn from_strings<I, S>(strings: I) -> Self
pub fn from_strings<I, S>(strings: I) -> Self
Decode the strings of a received record. Each splits at its first =;
one without = is a key with no value, and one with an empty key is
skipped. Keys are decoded as UTF-8 with replacement and lowercased
(ebus.py:136-153); a later duplicate of a key is dropped.
Sourcepub fn insert_raw(&mut self, key: String, value: Option<Vec<u8>>) -> bool
pub fn insert_raw(&mut self, key: String, value: Option<Vec<u8>>) -> bool
Add key with value unless the record already holds the key;
returns whether it was added.
Sourcepub fn insert(&mut self, key: &str, value: &str) -> bool
pub fn insert(&mut self, key: &str, value: &str) -> bool
Add key=value unless the record already holds the key; returns
whether it was added.
Sourcepub fn contains_key(&self, key: &str) -> bool
pub fn contains_key(&self, key: &str) -> bool
True when the record holds key.
Sourcepub fn get(&self, key: &str) -> Option<Cow<'_, str>>
pub fn get(&self, key: &str) -> Option<Cow<'_, str>>
The value of key as text, decoded as UTF-8 with replacement; ""
for a key with no value; None when the key is absent.
Sourcepub fn get_raw(&self, key: &str) -> Option<Option<&[u8]>>
pub fn get_raw(&self, key: &str) -> Option<Option<&[u8]>>
The raw value of key: Some(None) for a key with no value.
Sourcepub fn to_strings(&self) -> Vec<Vec<u8>>
pub fn to_strings(&self) -> Vec<Vec<u8>>
The record’s strings, key=value or key, in order.