use static_assertions::assert_impl_all;
use super::{Error, Result};
use crate::{interface, message::Header, ObjectServer};
pub(crate) struct Introspectable;
#[interface(
name = "org.freedesktop.DBus.Introspectable",
introspection_docs = false,
proxy(default_path = "/", visibility = "pub")
)]
impl Introspectable {
async fn introspect(
&self,
#[zbus(object_server)] server: &ObjectServer,
#[zbus(header)] header: Header<'_>,
) -> Result<String> {
let path = header.path().ok_or(crate::Error::MissingField)?;
let root = server.root().read().await;
let node = root
.get_child(path)
.ok_or_else(|| Error::UnknownObject(format!("Unknown object '{path}'")))?;
Ok(node.introspect().await)
}
}
assert_impl_all!(IntrospectableProxy<'_>: Send, Sync, Unpin);
#[cfg(feature = "blocking-api")]
assert_impl_all!(IntrospectableProxyBlocking<'_>: Send, Sync, Unpin);