Skip to content

Commit

Permalink
apply doc suggestions
Browse files Browse the repository at this point in the history
Co-authored-by: David Hewitt <mail@davidhewitt.dev>
  • Loading branch information
Icxolu and davidhewitt authored Oct 23, 2024
1 parent 342dedb commit 2ed88ed
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 24 deletions.
2 changes: 1 addition & 1 deletion guide/src/conversions/traits.md
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ struct Struct {
struct Tuple<'a, K: Hash + Eq, V>(&'a str, HashMap<K, V>);
```

For structs with a single field (newtype patter) the `#[pyo3(transparent)]` option can be used to
For structs with a single field (newtype pattern) the `#[pyo3(transparent)]` option can be used to
forward the implementation to the inner type.


Expand Down
23 changes: 0 additions & 23 deletions guide/src/migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,29 +164,6 @@ struct Struct {
}
```

will expand into the following:

```rust
# use pyo3::prelude::*;
# use pyo3::types::PyDict;
# struct Struct {
# count: usize,
# obj: Py<PyAny>,
# }

impl<'py> IntoPyObject<'py> for Struct {
type Target = PyDict;
type Output = Bound<'py, Self::Target>;
type Error = PyErr;

fn into_pyobject(self, py: Python<'py>) -> Result<Self::Output, Self::Error> {
let dict = PyDict::new(py);
dict.set_item("count", self.count)?;
dict.set_item("obj", self.obj)?;
Ok(dict)
}
}
```

#### `IntoPyObject` manual implementation

Expand Down

0 comments on commit 2ed88ed

Please sign in to comment.