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

Method try_from_object

crates/vm/src/function/buffer.rs:149–153  ·  view source on GitHub ↗
(vm: &VirtualMachine, obj: PyObjectRef)

Source from the content-addressed store, hash-verified

147
148impl TryFromObject for ArgStrOrBytesLike {
149 fn try_from_object(vm: &VirtualMachine, obj: PyObjectRef) -> PyResult<Self> {
150 obj.downcast()
151 .map(Self::Str)
152 .or_else(|obj| ArgBytesLike::try_from_object(vm, obj).map(Self::Buf))
153 }
154}
155
156impl ArgStrOrBytesLike {

Callers

nothing calls this directly

Calls 6

downcastMethod · 0.80
StringClass · 0.50
ErrClass · 0.50
mapMethod · 0.45
is_asciiMethod · 0.45
as_wtf8Method · 0.45

Tested by

no test coverage detected