Skip to main content

conspire/geometry/ntree/index/
mod.rs

1use crate::geometry::ntree::node::slot::Slot;
2use crate::geometry::ntree::{Orthotree, node::Node};
3use std::ops::{Index, IndexMut};
4
5impl<const D: usize, const L: usize, const M: usize, const N: usize, T, U, V> Index<U>
6    for Orthotree<D, L, M, N, T, U, V>
7where
8    U: Slot,
9{
10    type Output = Node<D, M, N, T, U, V>;
11    fn index(&self, idx: U) -> &Self::Output {
12        &self.nodes[idx.slot()]
13    }
14}
15
16impl<const D: usize, const L: usize, const M: usize, const N: usize, T, U, V> IndexMut<U>
17    for Orthotree<D, L, M, N, T, U, V>
18where
19    U: Slot,
20{
21    fn index_mut(&mut self, idx: U) -> &mut Self::Output {
22        &mut self.nodes[idx.slot()]
23    }
24}