MCPcopy Index your code
hub / github.com/RustPython/RustPython / as_str

Method as_str

crates/common/src/str.rs:263–267  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

261 // TODO: rename to to_str
262 #[inline]
263 pub fn as_str(&self) -> Option<&str> {
264 self.kind
265 .is_utf8()
266 .then(|| unsafe { core::str::from_utf8_unchecked(self.data.as_bytes()) })
267 }
268
269 pub fn as_ascii(&self) -> Option<&AsciiStr> {
270 self.kind

Callers 15

compileFunction · 0.45
_compute_char_lenMethod · 0.45
try_get_charsFunction · 0.45
format_complex_localeMethod · 0.45
parse_usizeFunction · 0.45
test_fill_and_alignFunction · 0.45
decodeFunction · 0.45
scan_parameterMethod · 0.45
scan_statementMethod · 0.45
scan_expressionMethod · 0.45
scan_type_paramsMethod · 0.45
register_identMethod · 0.45

Calls 3

thenMethod · 0.45
is_utf8Method · 0.45
as_bytesMethod · 0.45

Tested by 1

test_fill_and_alignFunction · 0.36