aboutsummaryrefslogtreecommitdiff
path: root/embassy-net/src/dns.rs
diff options
context:
space:
mode:
Diffstat (limited to 'embassy-net/src/dns.rs')
-rw-r--r--embassy-net/src/dns.rs25
1 files changed, 10 insertions, 15 deletions
diff --git a/embassy-net/src/dns.rs b/embassy-net/src/dns.rs
index 8ccfa4e4f..1fbaea4f0 100644
--- a/embassy-net/src/dns.rs
+++ b/embassy-net/src/dns.rs
@@ -9,7 +9,7 @@ pub use smoltcp::socket::dns::{DnsQuery, Socket};
9pub(crate) use smoltcp::socket::dns::{GetQueryResultError, StartQueryError}; 9pub(crate) use smoltcp::socket::dns::{GetQueryResultError, StartQueryError};
10pub use smoltcp::wire::{DnsQueryType, IpAddress}; 10pub use smoltcp::wire::{DnsQueryType, IpAddress};
11 11
12use crate::{Driver, Stack}; 12use crate::Stack;
13 13
14/// Errors returned by DnsSocket. 14/// Errors returned by DnsSocket.
15#[derive(Debug, PartialEq, Eq, Clone, Copy)] 15#[derive(Debug, PartialEq, Eq, Clone, Copy)]
@@ -44,21 +44,15 @@ impl From<StartQueryError> for Error {
44/// This exists only for compatibility with crates that use `embedded-nal-async`. 44/// This exists only for compatibility with crates that use `embedded-nal-async`.
45/// Prefer using [`Stack::dns_query`](crate::Stack::dns_query) directly if you're 45/// Prefer using [`Stack::dns_query`](crate::Stack::dns_query) directly if you're
46/// not using `embedded-nal-async`. 46/// not using `embedded-nal-async`.
47pub struct DnsSocket<'a, D> 47pub struct DnsSocket<'a> {
48where 48 stack: Stack<'a>,
49 D: Driver + 'static,
50{
51 stack: &'a Stack<D>,
52} 49}
53 50
54impl<'a, D> DnsSocket<'a, D> 51impl<'a> DnsSocket<'a> {
55where
56 D: Driver + 'static,
57{
58 /// Create a new DNS socket using the provided stack. 52 /// Create a new DNS socket using the provided stack.
59 /// 53 ///
60 /// NOTE: If using DHCP, make sure it has reconfigured the stack to ensure the DNS servers are updated. 54 /// NOTE: If using DHCP, make sure it has reconfigured the stack to ensure the DNS servers are updated.
61 pub fn new(stack: &'a Stack<D>) -> Self { 55 pub fn new(stack: Stack<'a>) -> Self {
62 Self { stack } 56 Self { stack }
63 } 57 }
64 58
@@ -72,10 +66,7 @@ where
72 } 66 }
73} 67}
74 68
75impl<'a, D> embedded_nal_async::Dns for DnsSocket<'a, D> 69impl<'a> embedded_nal_async::Dns for DnsSocket<'a> {
76where
77 D: Driver + 'static,
78{
79 type Error = Error; 70 type Error = Error;
80 71
81 async fn get_host_by_name( 72 async fn get_host_by_name(
@@ -124,3 +115,7 @@ where
124 todo!() 115 todo!()
125 } 116 }
126} 117}
118
119fn _assert_covariant<'a, 'b: 'a>(x: DnsSocket<'b>) -> DnsSocket<'a> {
120 x
121}