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

Method peek_byte

crates/css_lexer/src/private.rs:35–43  ·  view source on GitHub ↗
(&self, n: usize)

Source from the content-addressed store, hash-verified

33 /// Returns 0 (NUL) if past end — this maps to EOF in the CSS spec.
34 #[inline(always)]
35 fn peek_byte(&self, n: usize) -> u8 {
36 let idx = self.pos + n;
37 if idx < self.bytes.len() {
38 // SAFETY: we just checked bounds
39 unsafe { *self.bytes.get_unchecked(idx) }
40 } else {
41 0
42 }
43 }
44
45 /// Peek the next char (decoding UTF-8 if needed). Returns EOF ('\0') if at end.
46 #[inline(always)]

Callers 13

consume_newlineMethod · 0.80
consume_sameMethod · 0.80
consume_whitespaceMethod · 0.80
consume_hex_escapeMethod · 0.80
consume_url_sequenceMethod · 0.80
consume_numeric_tokenMethod · 0.80
consume_string_tokenMethod · 0.80

Calls 1

lenMethod · 0.45

Tested by

no test coverage detected