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

Function try_magic_method

crates/stdlib/src/math.rs:346–359  ·  view source on GitHub ↗
(
        func_name: &'static PyStrInterned,
        vm: &VirtualMachine,
        value: &PyObject,
    )

Source from the content-addressed store, hash-verified

344 }
345
346 fn try_magic_method(
347 func_name: &'static PyStrInterned,
348 vm: &VirtualMachine,
349 value: &PyObject,
350 ) -> PyResult {
351 let method = vm.get_method_or_type_error(value.to_owned(), func_name, || {
352 format!(
353 "type '{}' doesn't define '{}' method",
354 value.class().name(),
355 func_name.as_str(),
356 )
357 })?;
358 method.call((), vm)
359 }
360
361 #[pyfunction]
362 fn trunc(x: PyObjectRef, vm: &VirtualMachine) -> PyResult {

Callers 3

truncFunction · 0.85
ceilFunction · 0.85
floorFunction · 0.85

Calls 3

to_ownedMethod · 0.45
callMethod · 0.45

Tested by

no test coverage detected