Remove size()

Signed-off-by: Walker Crouse <Walker.Crouse@coop.co.uk>
This commit is contained in:
Walker Crouse 2020-09-28 12:41:37 -04:00
parent 97ad8097e0
commit 2d3f8f0eed
2 changed files with 7 additions and 6 deletions

View File

@ -97,6 +97,12 @@ impl BonjourMdnsService {
pub fn register(&mut self) -> Result<EventLoop> {
debug!("Registering service: {:?}", self);
let txt_len = self
.txt_record
.as_ref()
.map(|t| t.0.get_length())
.unwrap_or(0);
let txt_record = self
.txt_record
.as_ref()
@ -112,7 +118,7 @@ impl BonjourMdnsService {
.domain(self.domain.as_ref().as_c_chars().unwrap_or_null())
.host(self.host.as_ref().as_c_chars().unwrap_or_null())
.port(self.port)
.txt_len(self.txt_record.as_ref().map(|t| t.size()).unwrap_or(0))
.txt_len(txt_len)
.txt_record(txt_record)
.callback(Some(register_callback))
.context(self.context as *mut c_void)

View File

@ -87,11 +87,6 @@ impl BonjourTxtRecord {
Box::new(Values(Iter::new(self)))
}
/// Returns the size of the raw bytes in the TXT record.
pub fn size(&self) -> u16 {
self.0.get_length()
}
/// Returns a new `HashMap` with this record's keys and values.
pub fn to_map(&self) -> HashMap<String, String> {
let mut m = HashMap::new();