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

Method lookup

crates/css_lexer/src/dyn_atom_registry.rs:129–133  ·  view source on GitHub ↗

Looks up a string by its dynamic atom bits.

(&self, bits: u32)

Source from the content-addressed store, hash-verified

127
128 /// Looks up a string by its dynamic atom bits.
129 fn lookup(&self, bits: u32) -> Option<&'static str> {
130 debug_assert!(Self::is_dynamic(bits), "lookup() called on static atom bits");
131 let index = (bits & ((1 << ATOM_DYNAMIC_BIT) - 1)) as usize; // Mask off dynamic bit to get index
132 self.bits_to_str_vec.read().unwrap().get(index).copied()
133 }
134
135 /// Returns true if the given bits represent a dynamic atom.
136 #[inline]

Callers 2

atom_to_strMethod · 0.80
bits_to_strMethod · 0.80

Calls 2

getMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected