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

Method fmt

crates/kernel/src/id.rs:87–96  ·  view source on GitHub ↗
(&self, f: &mut fmt::Formatter<'_>)

Source from the content-addressed store, hash-verified

85/// Meta mode: `Nat.add@a1b2c3d4`. Anon mode: `a1b2c3d4`.
86impl<M: KernelMode> fmt::Display for KId<M> {
87 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
88 let hex = self.addr.hex();
89 let short = &hex[..8.min(hex.len())];
90 if self.name.has_meta() {
91 self.name.meta_fmt(f)?;
92 write!(f, "@{short}")
93 } else {
94 write!(f, "{short}")
95 }
96 }
97}
98
99#[cfg(test)]

Callers

nothing calls this directly

Calls 4

hexMethod · 0.80
lenMethod · 0.45
has_metaMethod · 0.45
meta_fmtMethod · 0.45

Tested by

no test coverage detected