MCPcopy Create free account
hub / github.com/dgrunwald/rust-cpython / fmt

Method fmt

src/objectprotocol.rs:340–346  ·  view source on GitHub ↗
(&self, f: &mut fmt::Formatter)

Source from the content-addressed store, hash-verified

338
339impl fmt::Debug for PyObject {
340 fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
341 // TODO: we shouldn't use fmt::Error when repr() fails
342 let gil_guard = Python::acquire_gil();
343 let py = gil_guard.python();
344 let repr_obj = self.repr(py).map_err(|_| fmt::Error)?;
345 f.write_str(&repr_obj.to_string_lossy(py))
346 }
347}
348
349impl fmt::Display for PyObject {

Callers

nothing calls this directly

Calls 4

pythonMethod · 0.80
reprMethod · 0.80
to_string_lossyMethod · 0.80
strMethod · 0.80

Tested by

no test coverage detected