1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
//! Types and submodules for doing runtime reflection.
#[cfg(all(test, not(feature = "only_new_tests")))]
pub mod tests {
pub mod derive_reflection;
}
/// Implementation details of the sabi_extract tool.
///
/// This is here so that its tests run among other abi_stable tests.
#[doc(hidden)]
pub mod export_module;
/// Whether this is a module whose definition can be reflected on at runtime,
///
/// Module reflection only allows accessing public fields.
#[repr(u8)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, StableAbi)]
pub enum ModReflMode {
/// For modules that are reflected on at runtime.
///
/// This is the default for all types.
Module,
/// For types whose layout can't be iterated over.
///
/// If one uses `#[sabi(module_reflection(Opaque))]`
Opaque,
/// Delegates the layout to some other type,this is generally for references.
DelegateDeref {
/// To which layout in `TypeLayout.shared_vars.type_layouts` this delegates to.
layout_index: u8,
},
}
impl Default for ModReflMode {
fn default() -> Self {
ModReflMode::Opaque
}
}