Skip to content

Commit 87f4225

Browse files
committed
refactor: rename rkyv 08 Archived types to avoid clash with rkyv 07 ones
1 parent e405b77 commit 87f4225

27 files changed

Lines changed: 192 additions & 254 deletions

.github/workflows/build.yml

Lines changed: 17 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ jobs:
6868
- uses: LoliGothick/clippy-check@master
6969
with:
7070
token: ${{ secrets.GITHUB_TOKEN }}
71-
options: --features=serde,rkyv_08,test_utils --no-deps
71+
options: --features=serde,rkyv,rkyv_08,test_utils --no-deps
7272
name: Clippy (stable)
7373

7474
- name: Check Rustdoc Links
@@ -105,14 +105,8 @@ jobs:
105105
- uses: LoliGothick/clippy-check@master
106106
with:
107107
token: ${{ secrets.GITHUB_TOKEN }}
108-
options: --features tracing,fixed,f16,rkyv,serde --no-deps
109-
name: Clippy (nightly, rkyv 0.7)
110-
111-
- uses: LoliGothick/clippy-check@master
112-
with:
113-
token: ${{ secrets.GITHUB_TOKEN }}
114-
options: --features tracing,fixed,f16_rkyv_08,serde --no-deps
115-
name: Clippy (nightly, rkyv 0.8)
108+
options: --features tracing,fixed,rkyv,rkyv_08,serde --no-deps
109+
name: Clippy nightly
116110

117111
- name: Check Rustdoc Links
118112
run: RUSTDOCFLAGS="--deny broken_intra_doc_links" cargo doc --verbose --workspace --no-deps --document-private-items
@@ -148,11 +142,8 @@ jobs:
148142
crate: cargo-hack
149143
version: "^0.6"
150144

151-
- name: Cargo check all targets and features (rkyv 0.7)
152-
run: cargo hack check --workspace --each-feature --all-targets --exclude-features global_allocate,simd,rkyv_08,f16_rkyv_08
153-
154-
- name: Cargo check all targets and features (rkyv 0.8)
155-
run: cargo hack check --workspace --each-feature --all-targets --exclude-features global_allocate,simd,rkyv,f16
145+
- name: Cargo check all targets and features
146+
run: cargo hack check --workspace --each-feature --all-targets --exclude-features global_allocate,simd
156147

157148
check-unstable:
158149
name: Cargo Check (Nightly)
@@ -186,14 +177,12 @@ jobs:
186177
crate: cargo-hack
187178
version: "^0.6"
188179

189-
- name: Cargo check all targets and features (rkyv 0.7)
190-
run: cargo hack check --workspace --each-feature --all-targets --exclude-features rkyv_08,f16_rkyv_08
180+
- name: Cargo check all targets and features
181+
run: cargo hack check --workspace --each-feature --all-targets
191182

192-
- name: Cargo check all targets and features (rkyv 0.8)
193-
run: cargo hack check --workspace --each-feature --all-targets --exclude-features rkyv,f16
194183

195184
test-basic:
196-
name: Run Tests (Stable, no crate features enabled that require unstable Rust, Rkyv 0.7)
185+
name: Run Tests (Stable, no crate features enabled that require unstable Rust)
197186
runs-on: ubuntu-latest
198187
steps:
199188
- uses: actions/checkout@v4
@@ -221,41 +210,12 @@ jobs:
221210
run: |
222211
cargo run --example build-float-doctest-tree --features="rkyv"
223212
cargo run --example build-immutable-doctest-tree --features="rkyv"
224-
cargo test --workspace --features=serde,rkyv,test_utils
213+
cargo run --example build-float-doctest-tree-rkyv_08 --features="rkyv_08"
214+
cargo run --example build-immutable-doctest-tree-rkyv_08 --features="rkyv_08"
215+
cargo test --workspace --features=serde,rkyv,rkyv_08,test_utils
225216
226-
test-basic-rkyv-08:
227-
name: Run Tests (Stable, no crate features enabled that require unstable Rust, Rkyv 0.8)
228-
runs-on: ubuntu-latest
229-
steps:
230-
- uses: actions/checkout@v4
231-
with:
232-
show-progress: false
233-
234-
- name: Get latest stable Rust version
235-
run: |
236-
echo "LATEST_STABLE_RUST_VERSION=$(gh api /repos/rust-lang/rust/releases --jq ".[0].tag_name")" >> "$GITHUB_ENV"
237-
env:
238-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
239-
240-
- name: Cache Toolchain
241-
uses: actions/cache@v4
242-
with:
243-
path: ~/.rustup
244-
key: toolchain-x86-64-${{ env.LATEST_STABLE_RUST_VERSION }}
245-
246-
- name: Install `stable` Toolchain
247-
uses: actions-rust-lang/setup-rust-toolchain@v1
248-
with:
249-
components: rustfmt,clippy
250-
251-
- name: Cargo test
252-
run: |
253-
cargo run --example build-float-doctest-tree-rkyv_08 --features="rkyv_08"
254-
cargo run --example build-immutable-doctest-tree-rkyv_08 --features="rkyv_08"
255-
cargo test --workspace --features=serde,rkyv_08,test_utils
256-
257-
test-all-features-rkyv-07:
258-
name: Run Tests (Nightly, all features enabled except `rkyv_08`)
217+
test-all-features:
218+
name: Run Tests (Nightly, all features enabled)
259219
runs-on: ubuntu-latest
260220
steps:
261221
- uses: actions/checkout@v4
@@ -284,52 +244,16 @@ jobs:
284244
run: |
285245
cargo run --example build-float-doctest-tree --features="rkyv"
286246
cargo run --example build-immutable-doctest-tree --features="rkyv"
287-
cargo test --workspace --features "csv,f16,las,serde,simd,rkyv,test_utils,tracing"
288-
289-
- name: Cargo test (release build)
290-
env:
291-
RUSTFLAGS: '-C target-cpu=native'
292-
run: |
293-
cargo run --example build-float-doctest-tree --features="rkyv"
294-
cargo run --example build-immutable-doctest-tree --features="rkyv"
295-
cargo test --workspace --features "csv,f16,las,serde,simd,rkyv,test_utils,tracing" --release
296-
297-
test-all-features-rkyv-08:
298-
name: Run Tests (Nightly, all features enabled except `rkyv` to allow rkyv 0.8 support)
299-
runs-on: ubuntu-latest
300-
steps:
301-
- uses: actions/checkout@v4
302-
with:
303-
show-progress: false
304-
305-
- name: Get date
306-
run: |
307-
echo "TODAY_DATE=$(date -Idate)" >> "$GITHUB_ENV"
308-
env:
309-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
310-
311-
- name: Cache Toolchain
312-
uses: actions/cache@v4
313-
with:
314-
path: ~/.rustup
315-
key: toolchain-x86-64-nightly-${{ env.TODAY_DATE }}
316-
317-
- name: Install `nightly` Toolchain
318-
uses: actions-rust-lang/setup-rust-toolchain@v1
319-
with:
320-
toolchain: nightly
321-
components: rustfmt,clippy
322-
323-
- name: Cargo test (dev build)
324-
run: |
325247
cargo run --example build-float-doctest-tree-rkyv_08 --features="rkyv_08"
326248
cargo run --example build-immutable-doctest-tree-rkyv_08 --features="rkyv_08"
327-
cargo test --workspace --features "csv,f16_rkyv_08,las,serde,simd,rkyv_08,test_utils,tracing"
249+
cargo test --workspace --features "csv,f16,las,serde,simd,rkyv,rkyv_08,test_utils,tracing"
328250
329251
- name: Cargo test (release build)
330252
env:
331253
RUSTFLAGS: '-C target-cpu=native'
332254
run: |
255+
cargo run --example build-float-doctest-tree --features="rkyv"
256+
cargo run --example build-immutable-doctest-tree --features="rkyv"
333257
cargo run --example build-float-doctest-tree-rkyv_08 --features="rkyv_08"
334258
cargo run --example build-immutable-doctest-tree-rkyv_08 --features="rkyv_08"
335-
cargo test --workspace --features "csv,f16_rkyv_08,las,serde,simd,rkyv_08,test_utils,tracing" --release
259+
cargo test --workspace --features "csv,f16,las,serde,simd,rkyv,rkyv_08,test_utils,tracing" --release

.github/workflows/coverage.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ jobs:
4040
- name: Generate Coverage
4141
run: |
4242
cargo run --example build-immutable-doctest-tree-rkyv_08 --features="rkyv_08"
43-
cargo llvm-cov --features "csv,f16_rkyv_08,las,serde,simd,rkyv_08,test_utils,tracing" --tests --ignore-run-fail --workspace --codecov --output-path codecov.json
43+
cargo run --example build-immutable-doctest-tree --features="rkyv"
44+
cargo llvm-cov --features "csv,las,serde,simd,rkyv,rkyv_08,test_utils,tracing" --tests --ignore-run-fail --workspace --codecov --output-path codecov.json
4445
4546
- uses: codecov/codecov-action@v5
4647
with:

CHANGELOG.md

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Kiddo Changelog
22

3-
## [5.1.0] - 2025-06-20
3+
## [5.2.0] - 2025-06-29
44

55
It's been a while since the last release as my focus has been elsewhere, but I'm back in the k-d tree groove now
66
and looking to bring some new features and performance updates over the next few weeks.
@@ -12,20 +12,17 @@ Right now, the pre-existing `rkyv` crate feature still provides support for
1212
Rkyv 0.7 as before, and so the introduction of Rkyv 0.8 is non-breaking. To use Rkyv 0.8, enable the crate feature that is
1313
unsurprisingly named `rkyv_08`. There are some caveats to Rkyv 0.8 support:
1414

15-
* Use of `rkyv` and `rkyv_08` is mutually exclusive; due to limitations in Rkyv's derive macros and trait system, it seems
16-
impossible to support both at the same time. You may be able to achieve this to a limited extent by importing two versions of Kiddo
17-
at the same time, one with `rkyv` activated and the other with `rkyv_08`, but interop between the two will be limited
15+
* The rkyv 0.8.x Archived structs are prefixed with `ArchivedR8` rather than `Archived` to avoid clashing with the pre-existing
16+
rkyv 0.7 types.
1817
* You're unlikely to be able to successfully deserialize a tree serialized with Rkyv 0.7 into an Rkyv 0.8 object, and vice-versa.
1918
* Anyone using `rkyv` and `f16` / `half` at the same time may encounter issues updating to Rkyv 0.8. This is because the `half`
20-
crate, on which Kiddo's f16 support depends, only supports Rkyv 0.7 at version 2.4.1 and below, and only supports Rkyv 0.8 at versions
21-
2.5.0+. To use f16 in Kiddo with Rkyv 0.8, you need to enable the `f16_rkyv_08` crate feature to ensure that the correct versions
22-
of both Rkyv and half are pulled in.
23-
* Supporting both Rkyv 0.7 and 0.8 in the Kiddo library at the same time is a massive pain and will add significant maintenance burden
24-
going forward. As such, **this 5.1.0 version will be the only one that supports both Rkyv 0.7 and Rkyv 0.8. An upcoming version 6
25-
of Kiddo will remove support for Rkyv 0.7 entirely and only support Rkyv 0.8.**
26-
27-
All the best! Scott (@sdd)
28-
19+
crate only supports Rkyv 0.7 at version 2.4.1 and below, and only supports Rkyv 0.8 at versions
20+
2.5.0+.
21+
* Supporting both Rkyv 0.7 and 0.8 in the Kiddo crate at the same time is a massive pain and will add significant maintenance burden
22+
going forward. As such, **this 5.2.0 version will be the only one that supports both Rkyv 0.7 and Rkyv 0.8. An upcoming version 6
23+
of Kiddo will remove support for Rkyv 0.7 entirely and only support Rkyv 0.8.** At this point the annoying non-standard `ArchivedR8`
24+
prefix for the rkyv 0.8 types will be dropped in favour of the default naming scheme.
25+
*
2926
### ✨ Features
3027

3128
- Add support for Rkyv v0.8
@@ -54,6 +51,16 @@ All the best! Scott (@sdd)
5451
- Update formatting to comply with updated clippy rules of recent versions of Rust
5552
- Update rust crate ordered-float to v5
5653

54+
All the best! Scott (@sdd)
55+
56+
## [5.1.0] - 2025-06-20: **YANKED**
57+
58+
5.1.0 was yanked. It only supported Rkyv 0.7 and 0.8 in a mutually exclusive way, but I found a way to support both simultaneously
59+
a few days after publishing 5.1.0. This came at the expense of being a breaking change to 5.1.0, and to respect semver I'd have needed
60+
to release a 6.0.0 version that would have been immediately superseded by 7.0.0 that removed rkyv 0.7. Since 5.1.0 had only been out
61+
for a couple of days, and since the mutual exclusivity meant that the rkyv 0.8 structs were not even mentioned in the 5.1.0
62+
docs on docs.rs, I chose to yank 5.1.0 instead.
63+
5764
## [5.0.3] - 2024-12-21
5865

5966
### Deps
@@ -119,7 +126,8 @@ See `immutable-rkyv-serialize` and `immutable-rkyv-deserialize` in the examples
119126
**BREAKING CHANGE**: It was pointed out in https://github.com/sdd/kiddo/issues/159 that it was necessary to enable both `rkyv` and `serialize_rkyv` features to use Rkyv serialization. I took the opportunity of the major version bump to rationalize the feature names to make them easier to use.
120127
`serialize_rkyv` has been removed and now only `rkyv` feature is needed to enable Rkyv serialization.
121128
`serialize` has been renamed to `serde` in line with ecosystem conventions.
122-
`half` has been renamed to `f16` for clarity.
129+
`half` has been renamed to `f16` for clarity (but is not needed for `f16` support anyway and is only used to ensure that the `half` crate is only
130+
depended upon within the "half" examples and not as a core dependency)
123131

124132
### `max_qty` Changed to `NonZero<usize>`
125133

Cargo.toml

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -70,17 +70,10 @@ optional = true
7070

7171
# half 2.5.0 switched from rkyv 0.7 to rkyv 0.8.
7272
[dependencies.half]
73-
version = "<=2.4.1"
73+
version = "=2.4.1"
7474
optional = true
7575
features = ["num-traits"]
7676

77-
# half 2.5.0 switched from rkyv 0.7 to rkyv 0.8.
78-
[dependencies.half_2_5]
79-
package = "half"
80-
version = "2.5"
81-
optional = true
82-
features = ["num-traits", "rkyv"]
83-
8477
[dependencies.las]
8578
version = "0.9"
8679
optional = true
@@ -136,7 +129,6 @@ csv = ["dep:csv"]
136129
default = ["tracing", "fixed"]
137130
modified_van_emde_boas = []
138131
f16 = ["dep:half"]
139-
f16_rkyv_08 = ["dep:half_2_5", "rkyv_08"]
140132
fixed = ["dep:fixed"]
141133
global_allocate = []
142134
las = ["dep:las"]
@@ -237,11 +229,6 @@ name = "half"
237229
path = "examples/half.rs"
238230
required-features = ["f16"]
239231

240-
[[example]]
241-
name = "half_rkyv_08"
242-
path = "examples/half_rkyv_08.rs"
243-
required-features = ["f16_rkyv_08"]
244-
245232
[[example]]
246233
name = "immutable-large"
247234
path = "examples/immutable-large.rs"

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ Kiddo provides:
1919
- Its standard floating point k-d tree, exposed as [`kiddo::KdTree`](`crate::KdTree`)
2020
- An [`ImmutableKdTree`](`immutable::float::kdtree::ImmutableKdTree`) with space and performance advantages over the standard
2121
k-d tree, for situations where the tree does not need to be modified after creation
22-
- **Integer / fixed point support** via the [`Fixed`](https://docs.rs/fixed/latest/fixed/) library;
23-
- **`f16` support** via the [`half`](https://docs.rs/half/latest/half/) library;
22+
- **Integer / fixed point support** via the [`Fixed`](https://docs.rs/fixed/latest/fixed/) crate;
23+
- **`f16` support** via the [`half`](https://docs.rs/half/latest/half/) crate;
2424
- **Instant zero-copy deserialization** and serialization via [`Rkyv`](https://docs.rs/rkyv/latest/rkyv/) ([`Serde`](https://docs.rs/serde/latest/serde/) still available).
2525

2626
## Usage

examples/float-rkyv_08-deserialize.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use tracing_subscriber::fmt;
1111

1212
use rkyv_08::rancor::Error as RkyvError;
1313

14-
use kiddo::float::kdtree::ArchivedKdTree;
14+
use kiddo::float::kdtree::ArchivedR8KdTree;
1515
use kiddo::float::kdtree::KdTree;
1616
use kiddo::SquaredEuclidean;
1717

@@ -116,7 +116,7 @@ where
116116

117117
// Get archived tree
118118
let archived_tree =
119-
rkyv_08::access::<ArchivedKdTree<f64, u32, 3, 32, u32>, RkyvError>(&buf[..]).unwrap();
119+
rkyv_08::access::<ArchivedR8KdTree<f64, u32, 3, 32, u32>, RkyvError>(&buf[..]).unwrap();
120120
let loaded = Instant::now();
121121

122122
println!("Tree Size: {}", archived_tree.size());
@@ -200,7 +200,7 @@ where
200200

201201
// Get archived tree using unsafe method
202202
let archived_tree =
203-
unsafe { rkyv_08::access_unchecked::<ArchivedKdTree<f64, u32, 3, 32, u32>>(&buf) };
203+
unsafe { rkyv_08::access_unchecked::<ArchivedR8KdTree<f64, u32, 3, 32, u32>>(&buf) };
204204
let loaded = Instant::now();
205205

206206
// perform a query using the wrapper

examples/half.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
#[cfg(all(
2-
feature = "f16",
3-
not(feature = "rkyv_08"),
4-
not(feature = "f16_rkyv_08")
5-
))]
1+
#[cfg(feature = "f16")]
62
fn main() -> Result<(), Box<dyn std::error::Error>> {
73
use half::f16;
84
use kiddo::{KdTree, SquaredEuclidean};
@@ -32,9 +28,9 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
3228
Ok(())
3329
}
3430

35-
#[cfg(any(not(feature = "f16"), feature = "f16_rkyv_08", feature = "rkyv_08"))]
31+
#[cfg(not(feature = "f16"))]
3632
fn main() -> Result<(), Box<dyn std::error::Error>> {
37-
println!("Activate the 'f16' feature to run this example properly. Ensure that the 'f16_rkyv_08' and 'rkyv_80' features are disabled.");
33+
println!("Activate the 'f16' feature to run this example properly.");
3834
println!("Try this: cargo run --example half --features=f16");
3935

4036
Ok(())

examples/half_rkyv_08.rs

Lines changed: 0 additions & 36 deletions
This file was deleted.

examples/immutable-rkyv_08-deserialize.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use tracing_subscriber::fmt;
1111

1212
use rkyv_08::{access, access_unchecked, from_bytes_unchecked, rancor::Error as RkyvError};
1313

14-
use kiddo::immutable::float::kdtree::ArchivedImmutableKdTree;
14+
use kiddo::immutable::float::kdtree::ArchivedR8ImmutableKdTree;
1515
use kiddo::immutable::float::kdtree::ImmutableKdTree;
1616
use kiddo::SquaredEuclidean;
1717

@@ -115,7 +115,7 @@ where
115115

116116
// Get archived tree
117117
let archived_tree =
118-
access::<ArchivedImmutableKdTree<f64, u32, 3, 256>, RkyvError>(&buf[..]).unwrap();
118+
access::<ArchivedR8ImmutableKdTree<f64, u32, 3, 256>, RkyvError>(&buf[..]).unwrap();
119119
let loaded = Instant::now();
120120

121121
// perform a query using the wrapper
@@ -196,7 +196,7 @@ where
196196

197197
// Get archived tree using unsafe method
198198
let archived_tree =
199-
unsafe { access_unchecked::<ArchivedImmutableKdTree<f64, u32, 3, 256>>(&buf) };
199+
unsafe { access_unchecked::<ArchivedR8ImmutableKdTree<f64, u32, 3, 256>>(&buf) };
200200
let loaded = Instant::now();
201201

202202
// perform a query using the wrapper

0 commit comments

Comments
 (0)