oxidd_manager_pointer/node/
mod.rs

1use std::sync::atomic;
2
3pub mod fixed_arity;
4
5/// Base traits to be satisfied by inner nodes for oxidd-manager. This does not
6/// include the [`InnerNode`][oxidd_core::InnerNode] trait.
7///
8/// # Safety
9///
10/// - The reference counter must be initialized to 2.
11/// - [`Self::load_rc()`] loads the reference count with the specified load
12///   order.
13pub unsafe trait NodeBase: arcslab::AtomicRefCounted + Eq + std::hash::Hash {
14    /// Whether this node type contains additional data that needs to be dropped
15    /// to avoid memory leaks.
16    ///
17    /// If the node only consists of [`Edge`][crate::manager::Edge]s and types
18    /// that implement [`Copy`], an implementation may return `false`. This may
19    /// speed up dropping a diagram a lot.
20    #[inline(always)]
21    fn needs_drop() -> bool {
22        true
23    }
24
25    /// Atomically load the current reference count with the given `order`
26    fn load_rc(&self, order: atomic::Ordering) -> usize;
27}