MCPcopy Create free account
hub / github.com/dgrunwald/rust-cpython / downcast_from

Method downcast_from

src/objects/string.rs:60–73  ·  view source on GitHub ↗
(
        py: Python<'_>,
        obj: PyObject,
    )

Source from the content-addressed store, hash-verified

58impl crate::python::PythonObjectWithCheckedDowncast for PyString {
59 #[inline]
60 fn downcast_from(
61 py: Python<'_>,
62 obj: PyObject,
63 ) -> Result<PyString, PythonObjectDowncastError<'_>> {
64 if is_base_string(&obj) {
65 Ok(PyString(obj))
66 } else {
67 Err(PythonObjectDowncastError::new(
68 py,
69 "PyString",
70 obj.get_type(py),
71 ))
72 }
73 }
74
75 #[inline]
76 fn downcast_borrow_from<'a, 'p>(

Callers

nothing calls this directly

Calls 3

is_base_stringFunction · 0.85
PyStringClass · 0.85
get_typeMethod · 0.45

Tested by

no test coverage detected