Skip to main content

NodeData

Trait NodeData 

Source
pub trait NodeData: Sized {
    type Error;
    type CacheAcceptor: CacheAcceptor<Self>;

    // Required method
    fn dedup(&mut self) -> Either<Node<Self>, Self::CacheAcceptor>;

    // Provided method
    fn backlink(
        &mut self,
        _backlink: Backlink<'_, Self>,
    ) -> Result<(), Self::Error> { ... }
}
Expand description

A trait implemented by items which can be placed into a node, but may require a node backlink

Required Associated Types§

Source

type Error

A possible error in placing an item into a node or deduplicating

Source

type CacheAcceptor: CacheAcceptor<Self>

An acceptor for cache entries

Required Methods§

Source

fn dedup(&mut self) -> Either<Node<Self>, Self::CacheAcceptor>

Attempt to deduplicate this NodeData, either succeeding or returning a cache entry to place the newly created node in should backlinking succeed.

Provided Methods§

Backlink this data to the given node. Warning: Any attempt to read the data of backlink in this function will lead to deadlock! Backlinking should not create new nodes if dedup obtains a lock on the cache table!

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§