MCPcopy Create free account
hub / github.com/argumentcomputer/ix / MetaDisplay

Interface MetaDisplay

crates/kernel/src/mode.rs:101–109  ·  view source on GitHub ↗

Display metadata conditionally across kernel modes. In Meta mode, concrete types display their content. In Anon mode, `()` signals no content via `has_meta() == false`, and callers provide a positional or hash fallback. This enables a single generic `Display` impl per zero kernel type instead of separate Meta/Anon impls.

Source from the content-addressed store, hash-verified

99/// fallback. This enables a single generic `Display` impl per zero kernel type
100/// instead of separate Meta/Anon impls.
101pub trait MetaDisplay {
102 /// Whether this field carries displayable metadata.
103 /// `false` for `()` (Anon mode) and anonymous `Name`s.
104 fn has_meta(&self) -> bool;
105
106 /// Format the metadata value. Callers should check `has_meta()` first
107 /// and provide a fallback (e.g., positional index) when `false`.
108 fn meta_fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result;
109}
110
111impl MetaDisplay for Name {
112 fn has_meta(&self) -> bool {

Callers

nothing calls this directly

Implementers 2

id.rscrates/kernel/src/id.rs
mode.rscrates/kernel/src/mode.rs

Calls

no outgoing calls

Tested by

no test coverage detected