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

Method numeric_len

crates/css_lexer/src/token.rs:784–791  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

782 /// Asserts: the `kind()` is [Kind::Dimension] or [Kind::Number].
783 #[inline]
784 pub const fn numeric_len(&self) -> u32 {
785 debug_assert!(matches!(self.kind(), Kind::Number | Kind::Dimension | Kind::BadNumber | Kind::BadDimension));
786 if self.kind_bits() & 0b1111 == Kind::Dimension as u8 {
787 (self.0 & LENGTH_MASK) >> 12
788 } else {
789 self.0 & LENGTH_MASK
790 }
791 }
792
793 /// If the [Token] is a [Kind::Dimension] or [Kind::Number] then this returns the [f32] representation of the number's
794 /// value.

Callers 6

peekMethod · 0.80
may_compactMethod · 0.80
can_compact_numberMethod · 0.80
lenMethod · 0.80
leading_lenMethod · 0.80
fmtMethod · 0.80

Calls 1

kind_bitsMethod · 0.80

Tested by

no test coverage detected