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/).
7
7
8
8
## [ Unreleased]
9
9
10
+ - Let ` &T ` for ` T: Dns ` implement ` Dns `
11
+
10
12
## [ 0.4.0] - 2023-01-27
11
13
12
14
- Add traits for UDP
Original file line number Diff line number Diff line change @@ -32,3 +32,19 @@ pub trait Dns {
32
32
/// [`rfc1035`]: https://tools.ietf.org/html/rfc1035
33
33
async fn get_host_by_address ( & self , addr : IpAddr ) -> Result < String < 256 > , Self :: Error > ;
34
34
}
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