MCPcopy Create free account
hub / github.com/csskit/csskit / atom_to_str

Method atom_to_str

crates/css_lexer/src/dyn_atom_registry.rs:97–100  ·  view source on GitHub ↗

Converts an atom back to its string representation. Returns `None` for invalid atoms.

(&self, atom: Atom<T>)

Source from the content-addressed store, hash-verified

95
96 /// Converts an atom back to its string representation. Returns `None` for invalid atoms.
97 pub fn atom_to_str(&self, atom: Atom<T>) -> Option<&'static str> {
98 let bits = atom.as_bits();
99 if DynAtomRegistry::<T>::is_dynamic(bits) { self.lookup(bits) } else { Some(T::from_bits(bits).to_str()) }
100 }
101
102 /// Interns a string, returning its dynamic atom bits.
103 fn atomize(&self, s: &str) -> u32 {

Callers

nothing calls this directly

Calls 3

as_bitsMethod · 0.80
lookupMethod · 0.80
to_strMethod · 0.80

Tested by

no test coverage detected