openthread/ot/
dns_upstream.rs1use crate::prelude_internal::*;
6use std::mem::transmute;
7
8pub trait DnsUpstream {
10 fn plat_dns_upstream_query_done(
12 &self,
13 query_context: &PlatDnsUpstreamQuery,
14 response: ot::Box<Message<'_>>,
15 );
16}
17
18impl<T: DnsUpstream + ot::Boxable> DnsUpstream for ot::Box<T> {
19 fn plat_dns_upstream_query_done(
20 &self,
21 query_context: &PlatDnsUpstreamQuery,
22 response: ot::Box<Message<'_>>,
23 ) {
24 self.as_ref().plat_dns_upstream_query_done(query_context, response)
25 }
26}
27
28#[allow(clippy::useless_transmute)]
32unsafe fn dns_upstream_query_context_get_mut(
33 original: &PlatDnsUpstreamQuery,
34) -> *mut otPlatDnsUpstreamQuery {
35 transmute(original)
36}
37
38impl DnsUpstream for Instance {
39 fn plat_dns_upstream_query_done(
40 &self,
41 query_context: &PlatDnsUpstreamQuery,
42 response: ot::Box<Message<'_>>,
43 ) {
44 unsafe {
45 otPlatDnsUpstreamQueryDone(
46 self.as_ot_ptr(),
47 dns_upstream_query_context_get_mut(query_context),
48 response.take_ot_ptr(),
49 );
50 }
51 }
52}