From ac92f77e38fd7ad0f118393f377010345cc43cb4 Mon Sep 17 00:00:00 2001 From: Mathias Date: Tue, 5 Dec 2023 08:41:20 +0100 Subject: [PATCH 1/2] Change blocking Dns::get_host_by_address back to mutable self, to align with Dns::get_host_by_name --- src/dns.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dns.rs b/src/dns.rs index 2e7ff4d..f1dc296 100644 --- a/src/dns.rs +++ b/src/dns.rs @@ -47,7 +47,7 @@ pub trait Dns { /// buffer to guarantee it'll always be large enough. /// /// [`rfc1035`]: https://tools.ietf.org/html/rfc1035 - fn get_host_by_address(&self, addr: IpAddr, result: &mut [u8]) -> Result; + fn get_host_by_address(&mut self, addr: IpAddr, result: &mut [u8]) -> Result; } impl Dns for &mut T { @@ -61,7 +61,7 @@ impl Dns for &mut T { T::get_host_by_name(self, hostname, addr_type) } - fn get_host_by_address(&self, addr: IpAddr, result: &mut [u8]) -> Result { + fn get_host_by_address(&mut self, addr: IpAddr, result: &mut [u8]) -> Result { T::get_host_by_address(self, addr, result) } } From b50cd310aee598cafb1858a9918cd34de4b07264 Mon Sep 17 00:00:00 2001 From: Mathias Date: Tue, 5 Dec 2023 08:47:24 +0100 Subject: [PATCH 2/2] Add back nb to Dns::get_host_by_address --- src/dns.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/dns.rs b/src/dns.rs index f1dc296..be4c04e 100644 --- a/src/dns.rs +++ b/src/dns.rs @@ -47,7 +47,11 @@ pub trait Dns { /// buffer to guarantee it'll always be large enough. /// /// [`rfc1035`]: https://tools.ietf.org/html/rfc1035 - fn get_host_by_address(&mut self, addr: IpAddr, result: &mut [u8]) -> Result; + fn get_host_by_address( + &mut self, + addr: IpAddr, + result: &mut [u8], + ) -> nb::Result; } impl Dns for &mut T { @@ -61,7 +65,11 @@ impl Dns for &mut T { T::get_host_by_name(self, hostname, addr_type) } - fn get_host_by_address(&mut self, addr: IpAddr, result: &mut [u8]) -> Result { + fn get_host_by_address( + &mut self, + addr: IpAddr, + result: &mut [u8], + ) -> nb::Result { T::get_host_by_address(self, addr, result) } }