orx_selfref_col/references/
refs.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
use core::fmt::Debug;

/// References among nodes.
pub trait Refs: Clone + Debug {
    /// Creates an empty references.
    fn empty() -> Self;

    /// Returns true if the references collection is empty.
    fn is_empty(&self) -> bool;

    /// Clears the references.
    fn clear(&mut self);

    /// Removes the reference at the given `ref_idx`.
    fn remove_at(&mut self, ref_idx: usize);

    /// Removes the node reference from references pointing to the node at given `ptr` location.
    ///
    /// Returns the position of the `ptr` among references if it exists; None otherwise.
    fn remove(&mut self, ptr: usize) -> Option<usize>;
}