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

Method matches

crates/csskit_ast/src/selector/query.rs:844–857  ·  view source on GitHub ↗

Returns true if the given size matches the comparison.

(&self, size: u16)

Source from the content-addressed store, hash-verified

842impl QuerySizePseudo {
843 /// Returns true if the given size matches the comparison.
844 pub fn matches(&self, size: u16) -> bool {
845 let target = {
846 let c: Cursor = self.comparison.value.into();
847 c.token().value() as u16
848 };
849 match &self.comparison.operator {
850 None => size == target,
851 Some(SizeOperator::NotEqual(_)) => size != target,
852 Some(SizeOperator::GreaterThan(_)) => size > target,
853 Some(SizeOperator::LessThan(_)) => size < target,
854 Some(SizeOperator::GreaterThanOrEqual(_)) => size >= target,
855 Some(SizeOperator::LessThanOrEqual(_)) => size <= target,
856 }
857 }
858}
859
860#[cfg(test)]

Callers

nothing calls this directly

Calls 2

valueMethod · 0.45
tokenMethod · 0.45

Tested by

no test coverage detected