Skip to content

Commit

Permalink
Add documentation related to from_py_with for the FromPyObject trait
Browse files Browse the repository at this point in the history
  • Loading branch information
ricohageman committed Feb 24, 2022
1 parent fc186cd commit bac033c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions guide/src/conversions/traits.md
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,10 @@ If the input is neither a string nor an integer, the error message will be:
- `pyo3(item)`, `pyo3(item("key"))`
- retrieve the field from a mapping, possibly with the custom key specified as an argument.
- can be any literal that implements `ToBorrowedObject`
- `pyo3(from_py_with = "...")`
- apply a custom function to convert the field from Python the desired Rust type.
- the argument must be the name of the function as a string.
- the function signature must be `fn(&PyAny) -> PyResult<T>` where `T` is the Rust type of the argument.

### `IntoPy<T>`

Expand Down

0 comments on commit bac033c

Please sign in to comment.