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

Method new_str

crates/vm/src/vm/context.rs:529–535  ·  view source on GitHub ↗
(&self, s: impl Into<pystr::PyStr>)

Source from the content-addressed store, hash-verified

527
528 #[inline]
529 pub fn new_str(&self, s: impl Into<pystr::PyStr>) -> PyRef<PyStr> {
530 let s = s.into();
531 if let Some(ch) = Self::latin1_singleton_index(&s) {
532 return self.latin1_char(ch);
533 }
534 s.into_ref(self)
535 }
536
537 #[inline]
538 pub fn new_utf8_str(&self, s: impl Into<PyUtf8Str>) -> PyRef<PyUtf8Str> {

Callers 15

slot_reprMethod · 0.45
extend_pyclassMethod · 0.45
reprMethod · 0.45
asciiMethod · 0.45
strMethod · 0.45
_trace_event_innerMethod · 0.45
ensure_valid_utf8Method · 0.45
splitMethod · 0.45
rsplitMethod · 0.45
lstripMethod · 0.45
rstripMethod · 0.45
__format__Method · 0.45

Calls 2

latin1_charMethod · 0.80
into_refMethod · 0.45

Tested by 1