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

Method as_bytes

crates/common/src/os.rs:114–117  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

112
113 impl OsStrExt for OsStr {
114 fn as_bytes(&self) -> &[u8] {
115 // WASI strings are guaranteed to be UTF-8
116 self.to_str().expect("wasip2 strings are UTF-8").as_bytes()
117 }
118
119 fn from_bytes(slice: &[u8]) -> &OsStr {
120 // WASI strings are guaranteed to be UTF-8

Callers 15

as_strMethod · 0.45
as_asciiMethod · 0.45
as_str_kindMethod · 0.45
format_boolMethod · 0.45
encode_utf8_compatibleFunction · 0.45
encodeFunction · 0.45
hash_strMethod · 0.45
into_vecMethod · 0.45
next_byteMethod · 0.45
peek_byteMethod · 0.45
parse_fstring_middleMethod · 0.45
parse_stringMethod · 0.45

Calls 1

to_strMethod · 0.80

Tested by

no test coverage detected