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

Method repr_wtf8

crates/vm/src/builtins/set.rs:941–954  ·  view source on GitHub ↗
(zelf: &crate::Py<Self>, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

939impl Representable for PySet {
940 #[inline]
941 fn repr_wtf8(zelf: &crate::Py<Self>, vm: &VirtualMachine) -> PyResult<Wtf8Buf> {
942 let class = zelf.class();
943 let borrowed_name = class.name();
944 let class_name = borrowed_name.deref();
945 if zelf.inner.len() == 0 {
946 return Ok(Wtf8Buf::from(format!("{class_name}()")));
947 }
948 if let Some(_guard) = ReprGuard::enter(vm, zelf.as_object()) {
949 let name = (class_name != "set").then_some(class_name);
950 zelf.inner.repr(name, vm)
951 } else {
952 Ok(Wtf8Buf::from(format!("{class_name}(...)")))
953 }
954 }
955}
956
957impl Constructor for PyFrozenSet {

Callers

nothing calls this directly

Calls 7

SomeClass · 0.50
classMethod · 0.45
nameMethod · 0.45
derefMethod · 0.45
lenMethod · 0.45
as_objectMethod · 0.45
reprMethod · 0.45

Tested by

no test coverage detected