MCPcopy Index your code
hub / github.com/dgrunwald/rust-cpython / with_extracted

Method with_extracted

src/objects/string.rs:540–546  ·  view source on GitHub ↗
(py: Python, obj: &PyObject, f: F)

Source from the content-addressed store, hash-verified

538/// In Python 2.7, `str` is expected to be UTF-8 encoded.
539impl RefFromPyObject for str {
540 fn with_extracted<F, R>(py: Python, obj: &PyObject, f: F) -> PyResult<R>
541 where
542 F: FnOnce(&str) -> R,
543 {
544 let s = obj.extract::<Cow<str>>(py)?;
545 Ok(f(&s))
546 }
547}
548
549/// For Python `bytes`, returns a reference to the existing immutable string data.

Callers

nothing calls this directly

Calls 1

fFunction · 0.85

Tested by

no test coverage detected