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

Method try_from_object

crates/vm/src/function/either.rs:77–82  ·  view source on GitHub ↗
(vm: &VirtualMachine, obj: PyObjectRef)

Source from the content-addressed store, hash-verified

75 B: TryFromObject,
76{
77 fn try_from_object(vm: &VirtualMachine, obj: PyObjectRef) -> PyResult<Self> {
78 A::try_from_object(vm, obj.clone())
79 .map(Either::A)
80 .or_else(|_| B::try_from_object(vm, obj.clone()).map(Either::B))
81 .map_err(|_| vm.new_type_error(format!("unexpected type {}", obj.class())))
82 }
83}

Callers

nothing calls this directly

Calls 2

mapMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected