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

Method try_from_borrowed_object

examples/call_between_rust_and_python.rs:85–88  ·  view source on GitHub ↗
(vm: &VirtualMachine, obj: &'a PyObject)

Source from the content-addressed store, hash-verified

83
84 impl<'a> TryFromBorrowedObject<'a> for PythonPerson {
85 fn try_from_borrowed_object(vm: &VirtualMachine, obj: &'a PyObject) -> PyResult<Self> {
86 let name = obj.get_attr("name", vm)?.try_into_value::<String>(vm)?;
87 Ok(Self { name })
88 }
89 }
90}

Callers

nothing calls this directly

Calls 1

get_attrMethod · 0.45

Tested by

no test coverage detected