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

Method slot_init

crates/vm/src/stdlib/_io.rs:1588–1601  ·  view source on GitHub ↗
(zelf: PyObjectRef, args: FuncArgs, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

1586
1587 #[pyslot]
1588 fn slot_init(zelf: PyObjectRef, args: FuncArgs, vm: &VirtualMachine) -> PyResult<()> {
1589 let zelf: PyRef<Self> = zelf.try_into_value(vm)?;
1590 let (raw, BufferSize { buffer_size }): (PyObjectRef, _) =
1591 args.bind(vm).map_err(|e| {
1592 let str_repr = e
1593 .__str__(vm)
1594 .as_ref()
1595 .map_or("<error getting exception str>".as_ref(), |s| s.as_wtf8())
1596 .to_owned();
1597 let msg = format!("{}() {}", Self::CLASS_NAME, str_repr);
1598 vm.new_exception_msg(e.class().to_owned(), msg.into())
1599 })?;
1600 zelf.init(raw, BufferSize { buffer_size }, vm)
1601 }
1602
1603 fn init(
1604 &self,

Callers

nothing calls this directly

Implementers 1

_io.rscrates/vm/src/stdlib/_io.rs

Calls 9

try_into_valueMethod · 0.80
new_exception_msgMethod · 0.80
bindMethod · 0.45
to_ownedMethod · 0.45
as_refMethod · 0.45
__str__Method · 0.45
as_wtf8Method · 0.45
classMethod · 0.45
initMethod · 0.45

Tested by

no test coverage detected