openthread/ot/
dns_upstream.rsuse crate::prelude_internal::*;
use std::mem::transmute;
pub trait DnsUpstream {
fn plat_dns_upstream_query_done(
&self,
query_context: &PlatDnsUpstreamQuery,
response: ot::Box<Message<'_>>,
);
}
impl<T: DnsUpstream + ot::Boxable> DnsUpstream for ot::Box<T> {
fn plat_dns_upstream_query_done(
&self,
query_context: &PlatDnsUpstreamQuery,
response: ot::Box<Message<'_>>,
) {
self.as_ref().plat_dns_upstream_query_done(query_context, response)
}
}
#[allow(clippy::useless_transmute)]
unsafe fn dns_upstream_query_context_get_mut(
original: &PlatDnsUpstreamQuery,
) -> *mut otPlatDnsUpstreamQuery {
transmute(original)
}
impl DnsUpstream for Instance {
fn plat_dns_upstream_query_done(
&self,
query_context: &PlatDnsUpstreamQuery,
response: ot::Box<Message<'_>>,
) {
unsafe {
otPlatDnsUpstreamQueryDone(
self.as_ot_ptr(),
dns_upstream_query_context_get_mut(query_context),
response.take_ot_ptr(),
);
}
}
}