pub struct OptionGroupMetadata {
pub name: &'static str,
pub doc: &'static str,
pub type_id: fn() -> TypeId,
}Expand description
Metadata captured at macro expansion for one group. Submitted
to the GROUP_DECLS distributed slice; the registry’s
startup loader walks the slice to validate uniqueness and
build the &str → TypeId lookup table.
Fields§
§name: &'static strThe group’s OptionGroup::NAME — the :customize <name> key.
doc: &'static strThe group’s OptionGroup::DOC.
type_id: fn() -> TypeIdTypeId::of::<G> for the group type, held as a function
pointer so the whole struct stays const-constructible; call it
to get the TypeId.
Implementations§
Source§impl OptionGroupMetadata
impl OptionGroupMetadata
Sourcepub const fn for_group<G: OptionGroup>() -> Self
pub const fn for_group<G: OptionGroup>() -> Self
Capture G’s name, doc and type id. const so the
crate::groups! expansion can build the GROUP_DECLS entry
in a static.
§Examples
use lattice_config::{Editor, OptionGroup, OptionGroupMetadata};
const META: OptionGroupMetadata = OptionGroupMetadata::for_group::<Editor>();
assert_eq!(META.name, "editor");
assert_eq!((META.type_id)(), std::any::TypeId::of::<Editor>());
assert_eq!(META.doc, Editor::DOC);Auto Trait Implementations§
impl Freeze for OptionGroupMetadata
impl RefUnwindSafe for OptionGroupMetadata
impl Send for OptionGroupMetadata
impl Sync for OptionGroupMetadata
impl Unpin for OptionGroupMetadata
impl UnsafeUnpin for OptionGroupMetadata
impl UnwindSafe for OptionGroupMetadata
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more