rapace_introspection/
lib.rs1#![doc = include_str!("../README.md")]
2
3pub use rapace_registry::introspection::{
5 ArgInfo, DefaultServiceIntrospection, MethodInfo, ServiceInfo,
6};
7
8#[rapace::service]
13pub trait ServiceIntrospection {
14 async fn list_services(&self) -> Vec<ServiceInfo>;
18
19 async fn describe_service(&self, name: String) -> Option<ServiceInfo>;
23
24 async fn has_method(&self, method_id: u32) -> bool;
28}
29
30impl ServiceIntrospection for DefaultServiceIntrospection {
31 async fn list_services(&self) -> Vec<ServiceInfo> {
32 self.list_services()
33 }
34
35 async fn describe_service(&self, name: String) -> Option<ServiceInfo> {
36 self.describe_service(&name)
37 }
38
39 async fn has_method(&self, method_id: u32) -> bool {
40 self.has_method(method_id)
41 }
42}
43
44#[cfg(test)]
45mod tests {
46 use super::*;
47
48 #[tokio::test]
49 async fn test_introspection_impl() {
50 let introspection = DefaultServiceIntrospection::new();
51
52 let _services = introspection.list_services();
54 let _has_zero = introspection.has_method(0);
55 let _describe = introspection.describe_service("NonExistent");
56 }
57}