Skip to content

Commit

Permalink
feat: Adds the Bound<'_, PyMappingProxy> type (#4644)
Browse files Browse the repository at this point in the history
* Mappingproxy (#1)

Adds in the MappingProxy type.

* Move over from `iter` to `try_iter`.

* Added lifetime to `try_iter`, preventing need to clone when iterating.

* Remove unneccessary borrow.

* Add newsfragment

* Newline to newsfragment.

* Remove  explicit lifetime,

* Review comments (#2)

* Addressing more comments
* Remove extract_bound.
* Remove extract methods.

* Update comments for list return type.

---------

Co-authored-by: Kevin Matlock <[email protected]>
  • Loading branch information
KLMatlock and Kevin Matlock authored Oct 29, 2024
1 parent 2d3bdc0 commit 0aa13c8
Show file tree
Hide file tree
Showing 5 changed files with 564 additions and 2 deletions.
1 change: 1 addition & 0 deletions newsfragments/4644.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
New `PyMappingProxy` struct corresponing to the `mappingproxy` class in Python.
1 change: 1 addition & 0 deletions src/prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ pub use crate::types::float::PyFloatMethods;
pub use crate::types::frozenset::PyFrozenSetMethods;
pub use crate::types::list::PyListMethods;
pub use crate::types::mapping::PyMappingMethods;
pub use crate::types::mappingproxy::PyMappingProxyMethods;
pub use crate::types::module::PyModuleMethods;
pub use crate::types::sequence::PySequenceMethods;
pub use crate::types::set::PySetMethods;
Expand Down
5 changes: 3 additions & 2 deletions src/sealed.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::types::{
PyBool, PyByteArray, PyBytes, PyCapsule, PyComplex, PyDict, PyFloat, PyFrozenSet, PyList,
PyMapping, PyModule, PySequence, PySet, PySlice, PyString, PyTraceback, PyTuple, PyType,
PyWeakref, PyWeakrefProxy, PyWeakrefReference,
PyMapping, PyMappingProxy, PyModule, PySequence, PySet, PySlice, PyString, PyTraceback,
PyTuple, PyType, PyWeakref, PyWeakrefProxy, PyWeakrefReference,
};
use crate::{ffi, Bound, PyAny, PyResult};

Expand Down Expand Up @@ -33,6 +33,7 @@ impl Sealed for Bound<'_, PyFloat> {}
impl Sealed for Bound<'_, PyFrozenSet> {}
impl Sealed for Bound<'_, PyList> {}
impl Sealed for Bound<'_, PyMapping> {}
impl Sealed for Bound<'_, PyMappingProxy> {}
impl Sealed for Bound<'_, PyModule> {}
impl Sealed for Bound<'_, PySequence> {}
impl Sealed for Bound<'_, PySet> {}
Expand Down
Loading

0 comments on commit 0aa13c8

Please sign in to comment.