Skip to main content

conspire/geometry/ntree/index/
mod.rs

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