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

Method __format__

crates/vm/src/builtins/bool.rs:104–109  ·  view source on GitHub ↗
(obj: PyObjectRef, spec: PyUtf8StrRef, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

102impl PyBool {
103 #[pymethod]
104 fn __format__(obj: PyObjectRef, spec: PyUtf8StrRef, vm: &VirtualMachine) -> PyResult<String> {
105 let new_bool = obj.try_to_bool(vm)?;
106 FormatSpec::parse(spec.as_str())
107 .and_then(|format_spec| format_spec.format_bool(new_bool))
108 .map_err(|err| err.into_pyexception(vm))
109 }
110}
111
112impl PyBool {

Callers

nothing calls this directly

Calls 5

try_to_boolMethod · 0.80
format_boolMethod · 0.80
parseFunction · 0.50
as_strMethod · 0.45
into_pyexceptionMethod · 0.45

Tested by

no test coverage detected