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

Method slot_str

crates/vm/src/builtins/bytearray.rs:219–225  ·  view source on GitHub ↗
(zelf: &PyObject, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

217
218 #[pyslot]
219 fn slot_str(zelf: &PyObject, vm: &VirtualMachine) -> PyResult<PyStrRef> {
220 let zelf = zelf.downcast_ref::<Self>().expect("expected bytearray");
221 PyBytesInner::warn_on_str("str() on a bytearray instance", vm)?;
222 let class_name = zelf.class().name();
223 let repr = zelf.inner().repr_with_name(&class_name, vm)?;
224 Ok(vm.ctx.new_str(repr))
225 }
226
227 fn __add__(&self, other: ArgBytesLike) -> Self {
228 self.inner().add(&other.borrow_buf()).into()

Callers

nothing calls this directly

Calls 5

repr_with_nameMethod · 0.80
nameMethod · 0.45
classMethod · 0.45
innerMethod · 0.45
new_strMethod · 0.45

Tested by

no test coverage detected