How can I get a reference to a value in a Bound<PyDict>
?
#4315
Unanswered
rossmacarthur
asked this question in
Questions
Replies: 1 comment
-
I suggest one of the following solutions: In PyO3 0.22 fn get_value_str<'py>(k: &str, dict: Option<&Bound<'py, PyDict>>) -> Option<Bound<'py, PyString>> {
dict?.get_item(k.to_lowercase()).ok()??.extract().ok()
} Or you can use fn get_value_str(k: &str, dict: Option<&Bound<'_, PyDict>>) -> Option<PyBackedStr> {
dict?.get_item(k.to_lowercase()).ok()??.extract().ok()
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
In an older version of
pyo3
I had the following functionNow I tried to do the following, but I get lifetime errors :(
Beta Was this translation helpful? Give feedback.
All reactions