Method
with_extracted
(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. |
| 539 | impl 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
Tested by
no test coverage detected