orx_selfref_col/references/refs.rs
1use core::fmt::Debug;
2
3/// References among nodes.
4pub trait Refs: Clone + Debug {
5 /// Creates an empty references.
6 fn empty() -> Self;
7
8 /// Returns true if the references collection is empty.
9 fn is_empty(&self) -> bool;
10
11 /// Clears the references.
12 fn clear(&mut self);
13
14 /// Removes the reference at the given `ref_idx`.
15 fn remove_at(&mut self, ref_idx: usize);
16
17 /// Removes the node reference from references pointing to the node at given `ptr` location.
18 ///
19 /// Returns the position of the `ptr` among references if it exists; None otherwise.
20 fn remove(&mut self, ptr: usize) -> Option<usize>;
21}