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

Method repr_wtf8

crates/vm/src/builtins/function.rs:1312–1330  ·  view source on GitHub ↗
(zelf: &Py<Self>, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

1310impl Representable for PyBoundMethod {
1311 #[inline]
1312 fn repr_wtf8(zelf: &Py<Self>, vm: &VirtualMachine) -> PyResult<Wtf8Buf> {
1313 let func_name = if let Some(qname) =
1314 vm.get_attribute_opt(zelf.function.clone(), identifier!(vm, __qualname__))?
1315 {
1316 Some(qname)
1317 } else {
1318 vm.get_attribute_opt(zelf.function.clone(), identifier!(vm, __name__))?
1319 };
1320 let func_name: Option<PyStrRef> = func_name.and_then(|o| o.downcast().ok());
1321 let object_repr = zelf.object.repr(vm)?;
1322 let name = func_name.as_ref().map_or("?".as_ref(), |s| s.as_wtf8());
1323 Ok(wtf8_concat!(
1324 "<bound method ",
1325 name,
1326 " of ",
1327 object_repr.as_wtf8(),
1328 ">"
1329 ))
1330 }
1331}
1332
1333#[pyclass(module = false, name = "cell", traverse)]

Callers

nothing calls this directly

Calls 8

get_attribute_optMethod · 0.80
okMethod · 0.80
downcastMethod · 0.80
SomeClass · 0.50
cloneMethod · 0.45
reprMethod · 0.45
as_refMethod · 0.45
as_wtf8Method · 0.45

Tested by

no test coverage detected