File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
77
88## [ Unreleased]
99
10+ - Let ` &T ` for ` T: Dns ` implement ` Dns `
11+
1012## [ 0.4.0] - 2023-01-27
1113
1214- Add traits for UDP
Original file line number Diff line number Diff line change @@ -32,3 +32,19 @@ pub trait Dns {
3232 /// [`rfc1035`]: https://tools.ietf.org/html/rfc1035
3333 async fn get_host_by_address ( & self , addr : IpAddr ) -> Result < String < 256 > , Self :: Error > ;
3434}
35+
36+ impl < T : Dns > Dns for & T {
37+ type Error = T :: Error ;
38+
39+ async fn get_host_by_name (
40+ & self ,
41+ host : & str ,
42+ addr_type : AddrType ,
43+ ) -> Result < IpAddr , Self :: Error > {
44+ T :: get_host_by_name ( self , host, addr_type) . await
45+ }
46+
47+ async fn get_host_by_address ( & self , addr : IpAddr ) -> Result < String < 256 > , Self :: Error > {
48+ T :: get_host_by_address ( self , addr) . await
49+ }
50+ }
You can’t perform that action at this time.
0 commit comments