Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,37 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Migrating

- **Float properties work without a wrapper.** `define_property!` and
`define_derived_property!` now derive `ixa::EqHash`, which implements `PartialEq`, `Eq` and
`Hash` with floats compared by value (`NaN` equals itself, `-0.0` equals `0.0`), so
`define_property!(struct Weight(f64), Person)` compiles and can be indexed. To migrate:
- Remove `impl_eq_hash = ...` arguments, and any hand-written `PartialEq`, `Eq` or `Hash`
impls on macro-declared types, which now conflict.
- On types you declare yourself, replace `#[derive(PartialEq, Eq, Hash)]` with
`#[derive(ixa::EqHash)]` if they hold floats.
- If you used `impl_eq_hash = neither` because a field type is only `PartialEq`, give that type
`Eq` and `Hash` too (`EqHash` if it holds floats). To keep a property `PartialEq`-only,
declare it by hand and use `impl_property!`.
- If your model depends on the sign of a zero: `-0.0` now equals `0.0`, and Ixa does not store
a value that equals the property's default. Setting `Weight(-0.0)` on a property whose
default is `Weight(0.0)` can therefore read back as `Weight(0.0)`. With
`impl_eq_hash = both` the two were different values and `-0.0` was kept.
- A constant of a struct property type can no longer be a `match` pattern, because the type
no longer has the std `PartialEq` derive: write `value if value == ADULT` instead of
`ADULT`. Enums declared with `define_property!` are unaffected.
- The fields of a named-field struct declared with `define_derived_property!` are now always
`pub`, as with `define_property!`; a written visibility was kept before.
- **Removed** `impl_property_eq!`, `impl_property_hash!` and `impl_property_eq_hash!` (each now
fails with an error pointing at `EqHash`), the `ixa::rkyv` re-export and dependency, and
`ixa::hashing::HasherWriter` / `EqualityBufferWriter`.

### Added

- `ixa::EqHash` derive: `PartialEq`, `Eq` and `Hash` for a property type, with floats (and
`Option`s, arrays and tuples of them) compared by value.

## [4.1.0](https://github.com/CDCgov/ixa/compare/ixa-v4.0.0...ixa-v4.1.0) - 2026-11-05

### Added
Expand Down
2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ ouroboros = "^0.18.5"
thiserror = "^2.0.11"
smallbox = "^0.8.8"
smallvec = "^1.15.1"
rkyv = "^0.8.15"

[package]
name = "ixa"
Expand Down Expand Up @@ -107,7 +106,6 @@ rustc-hash.workspace = true
thiserror.workspace = true
smallvec.workspace = true
smallbox.workspace = true
rkyv.workspace = true
tempfile.workspace = true
bincode-next.workspace = true

Expand Down
12 changes: 5 additions & 7 deletions docs/book/src/migration_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,20 +77,18 @@ impl_property!(

In the ordinary derive path, `define_property!` tacks on the `derive` traits and
`pub` visibility to the type definition and then calls `impl_property!` as
above. For property types that cannot derive `PartialEq` / `Eq` or `Hash`,
`define_property!` can also generate those implementations with
`impl_eq_hash = ...`; manually declared types can use `impl_property_eq!`,
`impl_property_hash!`, or `impl_property_eq_hash!` for the same generated
behavior, or client code can implement these traits itself.
above. Equality and hashing come from the `ixa::EqHash` derive, which compares
floats by value, so a property holding an `f64` needs no wrapper type; a
manually declared type derives `EqHash` itself.

The crucial thing to understand is that the value type _is_ the property type.
The `impl Property\<Person> for InfectionStatus`, which the macros give you, is
the thing that ties the `InfectionStatus` type to the `Person` entity.

For details about defining properties, see the `property_impl` module-level docs
and API docs for the macros `define_property!`, `impl_property!`,
`impl_property_eq!`, `impl_property_hash!`, `impl_property_eq_hash!`,
`define_derived_property!`, `impl_derived_property!`, and `define_multi_property!`.
`define_derived_property!`, `impl_derived_property!`, and `define_multi_property!`,
and the `EqHash` derive.
The API docs give multiple examples.

Multi-property definitions now take the entity first and the component
Expand Down
Loading
Loading