Skip to content

Commit 02c5283

Browse files
committed
index: reorganize exports
On `main`, almost everything is both exported publicly inside its own module as well as re-exported at the top-level. I've reorganized the exports such that everything is exported only at the top-level, except for the backends. For the backends, we may want to remove the type alias re-exports and export everything once under `understory_index::backends` (so we'd have `understory_index::backends::{Bvh, BvhF32, FlatVec, ...}`). Alternatively, we could simply also export all the backend stuff at the top-level.
1 parent 46cefa3 commit 02c5283

File tree

6 files changed

+26
-19
lines changed

6 files changed

+26
-19
lines changed

understory_box_tree/README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,11 @@ assumed to be finite (no NaNs). AABBs are loose for non-axis-aligned transforms
5959
clips: we store an axis-aligned box that fully contains what is drawn, but it is not
6060
guaranteed to be tight.
6161

62-
See [`understory_index::Index`], [`understory_index::RTreeF32`]/[`understory_index::RTreeF64`]/[`understory_index::RTreeI64`], and
63-
[`understory_index::BvhF32`]/[`understory_index::BvhF64`]/[`understory_index::BvhI64`] for details.
62+
See [`understory_index::Index`],
63+
[`understory_index::backends::RTreeF32`]/[`understory_index::backends::RTreeF64`]/[`understory_index::backends::RTreeI64`],
64+
and
65+
[`understory_index::backends::BvhF32`]/[`understory_index::backends::BvhF64`]/[`understory_index::backends::BvhI64`]
66+
for details.
6467

6568
## API overview
6669

understory_box_tree/src/lib.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,11 @@
4242
//! clips: we store an axis-aligned box that fully contains what is drawn, but it is not
4343
//! guaranteed to be tight.
4444
//!
45-
//! See [`understory_index::Index`], [`understory_index::RTreeF32`]/[`understory_index::RTreeF64`]/[`understory_index::RTreeI64`], and
46-
//! [`understory_index::BvhF32`]/[`understory_index::BvhF64`]/[`understory_index::BvhI64`] for details.
45+
//! See [`understory_index::Index`],
46+
//! [`understory_index::backends::RTreeF32`]/[`understory_index::backends::RTreeF64`]/[`understory_index::backends::RTreeI64`],
47+
//! and
48+
//! [`understory_index::backends::BvhF32`]/[`understory_index::backends::BvhF64`]/[`understory_index::backends::BvhI64`]
49+
//! for details.
4750
//!
4851
//! ## API overview
4952
//!

understory_box_tree/src/tree.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
66
use alloc::vec::Vec;
77
use kurbo::{Affine, Point, Rect, RoundedRect};
8-
use understory_index::{Aabb2D, Backend, FlatVec, IndexGeneric, Key as AabbKey};
8+
use understory_index::{Aabb2D, Backend, IndexGeneric, Key as AabbKey, backends::FlatVec};
99

1010
use crate::damage::Damage;
1111
use crate::types::{ClipBehavior, LocalNode, NodeFlags, NodeId};
@@ -1066,7 +1066,7 @@ mod tests {
10661066

10671067
#[test]
10681068
fn test_rtree_backend() {
1069-
use understory_index::RTreeF64;
1069+
use understory_index::backends::RTreeF64;
10701070

10711071
// Use an R-tree backend and verify basic hit-testing still works.
10721072
let mut tree: Tree<RTreeF64<NodeId>> = Tree::with_backend(RTreeF64::<NodeId>::default());
@@ -1084,7 +1084,7 @@ mod tests {
10841084

10851085
#[test]
10861086
fn test_bvh_backend() {
1087-
use understory_index::BvhF64;
1087+
use understory_index::backends::BvhF64;
10881088

10891089
// Use a BVH backend and verify basic hit-testing still works.
10901090
let mut tree: Tree<BvhF64> = Tree::with_backend(BvhF64::default());

understory_focus/src/adapters/box_tree.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ pub fn build_focus_space_for_scope<'a, B, P>(
9090
out: &'a mut Vec<FocusEntry<NodeId>>,
9191
) -> FocusSpace<'a, NodeId>
9292
where
93-
B: understory_index::backend::Backend<f64>,
93+
B: understory_index::Backend<f64>,
9494
P: FocusPropsLookup<NodeId>,
9595
{
9696
out.clear();

understory_index/src/backends/mod.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919
//! Accumulators are widened (`f32`→`f64`, `f64`→`f64`, `i64`→`i128`) for robust comparisons.
2020
//! Bulk builders use an STR-like pass to seed packed leaves and parents.
2121
22-
pub mod bvh;
23-
pub mod flatvec;
24-
pub mod rtree;
22+
pub(crate) mod bvh;
23+
pub(crate) mod flatvec;
24+
pub(crate) mod rtree;
25+
26+
pub use bvh::{Bvh, BvhF32, BvhF64, BvhI64};
27+
pub use flatvec::FlatVec;
28+
pub use rtree::{RTree, RTreeF32, RTreeF64, RTreeI64};

understory_index/src/lib.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,20 +75,17 @@
7575

7676
extern crate alloc;
7777

78-
pub mod backend;
78+
mod backend;
7979
pub mod backends;
80-
pub mod damage;
81-
pub mod index;
82-
pub mod types;
80+
mod damage;
81+
mod index;
82+
mod types;
8383
pub(crate) mod util;
8484

8585
pub use backend::Backend;
86-
pub use backends::bvh::{BvhF32, BvhF64, BvhI64};
87-
pub use backends::flatvec::FlatVec;
88-
pub use backends::rtree::{RTreeF32, RTreeF64, RTreeI64};
8986
pub use damage::Damage;
9087
pub use index::{Index, IndexGeneric, Key};
91-
pub use types::Aabb2D;
88+
pub use types::{Aabb2D, Scalar, ScalarAcc};
9289

9390
#[cfg(test)]
9491
mod tests {

0 commit comments

Comments
 (0)