NodeBase

Trait NodeBase 

Source
pub unsafe trait NodeBase: Eq + Hash {
    // Required methods
    fn retain(&self);
    unsafe fn release(&self) -> usize;
    fn load_rc(&self, order: Ordering) -> usize;

    // Provided method
    fn needs_drop() -> bool { ... }
}
Expand description

Base traits to be satisfied by inner nodes for oxidd-manager. This does not include the InnerNode trait.

§Safety

  • The reference counter must be initialized to 2.
  • Self::retain() increments the counter by 1
  • Self::release() decrements the counter by 1 with (at least) Release order.
  • Self::load_rc() loads the reference count with the specified load order.
  • An implementation must not modify the counter unless instructed externally via the retain() or release() methods.

Required Methods§

Source

fn retain(&self)

Atomically increment the reference counter (with Relaxed order)

This method is responsible for preventing an overflow of the reference counter.

Source

unsafe fn release(&self) -> usize

Atomically decrement the reference counter (with Release order)

Returns the previous reference count.

A call to this function only modifies the counter value and never drops self.

§Safety

The caller must give up ownership of one reference to self.

Source

fn load_rc(&self, order: Ordering) -> usize

Atomically load the current reference count with the given order

Provided Methods§

Source

fn needs_drop() -> bool

Whether this node type contains additional data that needs to be dropped to avoid memory leaks.

If the node only consists of Edges and types that implement Copy, an implementation may return false. This may speed up dropping a diagram a lot.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<ET: Tag, const ARITY: usize> NodeBase for NodeWithLevel<'_, ET, ARITY>