Skip to main content

hao_runtime/
reflect.rs

1//! Reflection roots for the `reflect` feature. See [`hao::reflect`](https://docs.rs/hao/latest/hao/reflect/index.html) for the
2//! pattern. The runtime handles (`Runtime`, `ClrHost`, the backends) hold raw
3//! pointers and library handles and are not reflected; the configuration and
4//! descriptor types are.
5
6use facet::{Facet, Shape};
7
8/// The reflected entry-point shapes. Which are present depends on the enabled
9/// backend features. When the `hao` feature is on, [`hao::reflect::roots`](https://docs.rs/hao/latest/hao/reflect/fn.roots.html) gives
10/// the metadata graph as well.
11pub fn roots() -> Vec<&'static Shape> {
12    #[allow(unused_mut)]
13    let mut roots: Vec<&'static Shape> = vec![
14        <crate::Backend as Facet>::SHAPE,
15        <crate::BoundAssembly as Facet>::SHAPE,
16    ];
17    #[cfg(feature = "coreclr")]
18    roots.extend([
19        <crate::CoreClrOptions as Facet>::SHAPE,
20        <crate::profiler::Guid as Facet>::SHAPE,
21    ]);
22    #[cfg(feature = "mono")]
23    roots.push(<crate::MonoOptions as Facet>::SHAPE);
24    roots
25}