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

Method miss

crates/vm/src/intern.rs:55–71  ·  view source on GitHub ↗
(zelf: &StringPool, s: PyRefExact<PyStr>)

Source from the content-addressed store, hash-verified

53
54 #[cold]
55 fn miss(zelf: &StringPool, s: PyRefExact<PyStr>) -> &'static PyStrInterned {
56 let cache = CachedPyStrRef { inner: s };
57 let inserted = zelf.inner.write().insert(cache.clone());
58 if inserted {
59 let interned = unsafe { cache.as_interned_str() };
60 unsafe { interned.as_object().mark_intern() };
61 interned
62 } else {
63 unsafe {
64 zelf.inner
65 .read()
66 .get(cache.as_ref())
67 .expect("inserted is false")
68 .as_interned_str()
69 }
70 }
71 }
72 let str_ref = s.into_pyref_exact(typ);
73 miss(self, str_ref)
74 }

Callers

nothing calls this directly

Calls 9

mark_internMethod · 0.80
insertMethod · 0.45
writeMethod · 0.45
cloneMethod · 0.45
as_interned_strMethod · 0.45
as_objectMethod · 0.45
getMethod · 0.45
readMethod · 0.45
as_refMethod · 0.45

Tested by

no test coverage detected