Skip to content

Commit

Permalink
refactor: remove need for gated import
Browse files Browse the repository at this point in the history
  • Loading branch information
sdd committed Feb 15, 2024
1 parent 81b3401 commit 8aa4fae
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
7 changes: 5 additions & 2 deletions src/fixed/kdtree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,10 @@ pub(crate) struct LeafNode<
const B: usize,
IDX,
> {
#[cfg_attr(feature = "serialize", serde(with = "array_of_arrays"))]
#[cfg_attr(
feature = "serialize",
serde(with = "crate::custom_serde::array_of_arrays")
)]
#[cfg_attr(
feature = "serialize",
serde(bound(
Expand All @@ -133,7 +136,7 @@ pub(crate) struct LeafNode<
// TODO: Refactor content_points to be [[A; B]; K] to see if this helps vectorisation
pub(crate) content_points: [[A; K]; B],

#[cfg_attr(feature = "serialize", serde(with = "array"))]
#[cfg_attr(feature = "serialize", serde(with = "crate::custom_serde::array"))]
#[cfg_attr(
feature = "serialize",
serde(bound(
Expand Down
7 changes: 5 additions & 2 deletions src/float/kdtree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,18 @@ pub struct StemNode<A: Copy + Default, const K: usize, IDX> {
)]
#[derive(Clone, Debug, PartialEq)]
pub struct LeafNode<A: Copy + Default, T: Copy + Default, const K: usize, const B: usize, IDX> {
#[cfg_attr(feature = "serialize", serde(with = "array_of_arrays"))]
#[cfg_attr(
feature = "serialize",
serde(with = "crate::custom_serde::array_of_arrays")
)]
#[cfg_attr(
feature = "serialize",
serde(bound(serialize = "A: Serialize", deserialize = "A: Deserialize<'de>"))
)]
// TODO: Refactor content_points to be [[A; B]; K] to see if this helps vectorisation
pub content_points: [[A; K]; B],

#[cfg_attr(feature = "serialize", serde(with = "array"))]
#[cfg_attr(feature = "serialize", serde(with = "crate::custom_serde::array"))]
#[cfg_attr(
feature = "serialize",
serde(bound(
Expand Down
7 changes: 5 additions & 2 deletions src/float_leaf_simd/leaf_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,17 @@ use crate::{float::kdtree::Axis, types::Content};
)]
#[derive(Clone, Debug, PartialEq)]
pub struct LeafNode<A: Copy + Default, T: Copy + Default, const K: usize, const B: usize> {
#[cfg_attr(feature = "serialize", serde(with = "array_of_arrays"))]
#[cfg_attr(
feature = "serialize",
serde(with = "crate::custom_serde::array_of_arrays")
)]
#[cfg_attr(
feature = "serialize",
serde(bound(serialize = "A: Serialize", deserialize = "A: Deserialize<'de>"))
)]
pub content_points: [[A; B]; K],

#[cfg_attr(feature = "serialize", serde(with = "array"))]
#[cfg_attr(feature = "serialize", serde(with = "crate::custom_serde::array"))]
#[cfg_attr(
feature = "serialize",
serde(bound(
Expand Down

0 comments on commit 8aa4fae

Please sign in to comment.