Skip to content

Commit

Permalink
Merge pull request #100 from rust-embedded-community/fix/dns-mut-self
Browse files Browse the repository at this point in the history
Change blocking Dns::get_host_by_address back to mutable self
  • Loading branch information
ryan-summers authored Dec 5, 2023
2 parents 5c41b3a + b50cd31 commit 2ad0b03
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/dns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(&self, addr: IpAddr, result: &mut [u8]) -> Result<usize, Self::Error>;
fn get_host_by_address(
&mut self,
addr: IpAddr,
result: &mut [u8],
) -> nb::Result<usize, Self::Error>;
}

impl<T: Dns> Dns for &mut T {
Expand All @@ -61,7 +65,11 @@ impl<T: Dns> 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<usize, Self::Error> {
fn get_host_by_address(
&mut self,
addr: IpAddr,
result: &mut [u8],
) -> nb::Result<usize, Self::Error> {
T::get_host_by_address(self, addr, result)
}
}

0 comments on commit 2ad0b03

Please sign in to comment.