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

Method extract

src/objects/string.rs:501–503  ·  view source on GitHub ↗
(py: Python, obj: &'s PyObject)

Source from the content-addressed store, hash-verified

499/// not valid UTF-8).
500impl<'s> FromPyObject<'s> for Cow<'s, str> {
501 fn extract(py: Python, obj: &'s PyObject) -> PyResult<Self> {
502 obj.cast_as::<PyString>(py)?.to_string(py)
503 }
504}
505
506/// Allows extracting strings from Python objects.

Callers

nothing calls this directly

Calls 4

to_stringMethod · 0.80
mapMethod · 0.80
dataMethod · 0.80

Tested by

no test coverage detected