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

Method as_ref

crates/vm/src/builtins/str.rs:92–94  ·  view source on GitHub ↗

<- can remove this once it doesn't panic

(&self)

Source from the content-addressed store, hash-verified

90impl AsRef<str> for PyStr {
91 #[track_caller] // <- can remove this once it doesn't panic
92 fn as_ref(&self) -> &str {
93 self.to_str().expect("str has surrogates")
94 }
95}
96
97impl AsRef<str> for Py<PyStr> {

Callers 15

concat_in_placeMethod · 0.45
encode_stringFunction · 0.45
getattr_innerMethod · 0.45
dedup_and_flatten_argsFunction · 0.45
to_objectMethod · 0.45
__or__Method · 0.45
cmpMethod · 0.45
repr_strMethod · 0.45
set___class__Method · 0.45
reduce_newobjFunction · 0.45
initMethod · 0.45

Calls 5

to_strMethod · 0.80
as_asciiMethod · 0.80
SomeClass · 0.50
as_wtf8Method · 0.45
as_strMethod · 0.45

Tested by

no test coverage detected