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

Method as_str

crates/css_lexer/src/small_str_buf.rs:27–34  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

25
26 #[inline]
27 pub fn as_str(&self) -> Option<&str> {
28 if self.over_capacity() {
29 None
30 } else {
31 // SAFETY: We only append valid UTF-8 chars, so this is always valid
32 Some(unsafe { str::from_utf8_unchecked(&self.1[0..self.0 as usize]) })
33 }
34 }
35}
36
37impl<const N: usize> Write for SmallStrBuf<N> {

Callers

nothing calls this directly

Calls 1

over_capacityMethod · 0.80

Tested by

no test coverage detected