pyo3/newsfragments
Michael Gilbert b8fb367582
feat: Add 'ord' option for PyClass and corresponding tests (#4202)
* feat: Add 'ord' option for PyClass and corresponding tests

Updated the macros back-end to include 'ord' as an option for PyClass allowing for Python-style ordering comparison of enum variants. Additionally, test cases to verify the proper functioning of this new feature have been introduced.

* update: fix formatting with cargo fmt

* update: documented added feature in newsfragments

* update: updated saved errors for comparison test for invalid pyclass args

* update: removed nested match arms and extended cases for ordering instead

* update: alphabetically ordered entries

* update: added section to class documentation with example for using ord argument.

* refactor: reduced duplication of code using closure to process tokens.

* update: used ensure_spanned macro to emit compile time errors for uses of ord on complex enums or structs, updated test errors for bad compile cases

* fix: remove errant character

* update: added note about PartialOrd being required.

* feat: implemented ordering for structs and complex enums.  Retained the equality logic for simple enums until PartialEq is deprecated.

* update: adjusted compile time error checks for missing PartialOrd implementations.  Refactored growing set of comparison tests for simple and complex enums and structs into separate test file.

* fix: updated with clippy findings

* update: added not to pyclass parameters on ord (assumes that eq will be implemented and merged first)

* update: rebased on main after merging of `eq` feature

* update: format update

* update: update all test output and doc tests

* Update guide/src/class.md

Co-authored-by: Icxolu <10486322+Icxolu@users.noreply.github.com>

* Update pyo3-macros-backend/src/pyclass.rs

Co-authored-by: Icxolu <10486322+Icxolu@users.noreply.github.com>

* Update newsfragments/4202.added.md

Co-authored-by: Icxolu <10486322+Icxolu@users.noreply.github.com>

* Update guide/pyclass-parameters.md

Co-authored-by: Icxolu <10486322+Icxolu@users.noreply.github.com>

* update: added note about `ord` implementation with example.

* fix doc formatting

---------

Co-authored-by: Michael Gilbert <git.3mc1o@aleeas.com>
Co-authored-by: Icxolu <10486322+Icxolu@users.noreply.github.com>
2024-06-07 19:08:53 +00:00
..
.gitignore
3761.changed.md
3835.added.md Add weakref Python types (#3835) 2024-05-31 19:13:50 +00:00
3966.packaging.md
4061.packaging.md
4072.added.md feat: support pyclass on tuple enums (#4072) 2024-05-17 02:59:00 +00:00
4078.changed.md deprecate implicit default for trailing optional arguments (#4078) 2024-05-10 10:34:58 +00:00
4079.added.md
4086.fixed.md
4095.added.md Remove deferred reference count increments and make the global reference pool optional (#4095) 2024-05-11 14:48:45 +00:00
4095.changed.md Remove deferred reference count increments and make the global reference pool optional (#4095) 2024-05-11 14:48:45 +00:00
4098.changed.md add #[track_caller] to all Py/Bound/Borrowed methods which panic (#4098) 2024-04-19 11:44:36 +00:00
4100.changed.md change PyAnyMethods::dir to be fallible (#4100) 2024-04-19 19:35:52 +00:00
4104.fixed.md fix vectorcall argument handling (#4104) 2024-04-22 08:56:39 +00:00
4116.fixed.md Disable PyUnicode_DATA on PyPy (#4116) 2024-04-26 06:00:13 +00:00
4117.fixed.md handle #[pyo3(from_py_with = ...)] on dunder (__magic__) methods (#4117) 2024-05-04 07:39:40 +00:00
4129.changed.md Update MSRV to 1.63 (#4129) 2024-04-28 16:11:28 +00:00
4148.added.md Add num-rational support for Python's fractions.Fraction type (#4148) 2024-05-09 15:37:53 +00:00
4158.added.md allow constructor customization of complex enum variants (#4158) 2024-05-09 21:08:23 +00:00
4178.changed.md Lazy-initialize the global reference pool to reduce its overhead when unused (#4178) 2024-06-06 08:45:16 +00:00
4184.packaging.md ci: start testing on 3.13-dev (#4184) 2024-05-25 22:41:26 +00:00
4197.added.md adding new getter for type obj (#4197) 2024-05-25 22:39:48 +00:00
4201.changed.md remove internal APIs from pyo3-ffi (#4201) 2024-06-05 21:21:44 +00:00
4202.added.md feat: Add 'ord' option for PyClass and corresponding tests (#4202) 2024-06-07 19:08:53 +00:00
4205.added.md Added ToPyObject and IntoPy<PyObject> impls for PyBackedStr. (#4205) 2024-06-01 21:09:14 +00:00
4206.added.md add pyclass hash option (#4206) 2024-06-01 14:20:20 +00:00
4210.added.md add pyclass eq option (#4210) 2024-05-31 14:13:30 +00:00
4210.changed.md add pyclass eq option (#4210) 2024-05-31 14:13:30 +00:00
4213.added.md Automated module= field creation in declarative modules (#4213) 2024-06-06 07:54:26 +00:00
4214.added.md Added From<Bound<'py, T>> impl for PyClassInitializer<T>. (#4214) 2024-05-28 01:49:52 +00:00
4226.fixed.md Use Ident::parse_any for name attributes (#4226) 2024-06-03 19:45:36 +00:00
4228.changed.md Allow module= attribute in complex enum variants (#4228) 2024-06-03 07:57:04 +00:00
4236.fixed.md Declarative modules: make sure to emit doc comments and other attributes (#4236) 2024-06-06 21:19:37 +00:00