DataKey

Trait DataKey 

Source
pub trait DataKey:
    Clone
    + Debug
    + Default
    + PartialEq
    + Eq
    + 'static {
    // Required methods
    fn make_id(&self, parent: &Id) -> Id;
    fn reconstruct_key(parent: &Id, child: &Id) -> Option<Self>;
}
Expand description

Bounds on the key type

This type should be small, easy to copy, and without internal mutability.

Required Methods§

Source

fn make_id(&self, parent: &Id) -> Id

Make an Id for a key

The result must be distinct from parent and a descendant of parent (use Id::make_child for this, optionally more than once).

Source

fn reconstruct_key(parent: &Id, child: &Id) -> Option<Self>

Reconstruct a key from an Id

Where child is the output of Self::make_id for the same parent or any Id descended from that, this should return a copy of the key passed to make_id.

See: Id::next_key_after, Id::iter_keys_after

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.

Implementations on Foreign Types§

Source§

impl DataKey for (u32, u32)

Source§

fn make_id(&self, parent: &Id) -> Id

Source§

fn reconstruct_key(parent: &Id, child: &Id) -> Option<Self>

Source§

impl DataKey for (u64, u64)

Source§

fn make_id(&self, parent: &Id) -> Id

Source§

fn reconstruct_key(parent: &Id, child: &Id) -> Option<Self>

Source§

impl DataKey for (usize, usize)

Source§

fn make_id(&self, parent: &Id) -> Id

Source§

fn reconstruct_key(parent: &Id, child: &Id) -> Option<Self>

Source§

impl DataKey for u32

Source§

fn make_id(&self, parent: &Id) -> Id

Source§

fn reconstruct_key(parent: &Id, child: &Id) -> Option<Self>

Source§

impl DataKey for u64

Source§

fn make_id(&self, parent: &Id) -> Id

Source§

fn reconstruct_key(parent: &Id, child: &Id) -> Option<Self>

Source§

impl DataKey for ()

Source§

fn make_id(&self, parent: &Id) -> Id

Source§

fn reconstruct_key(parent: &Id, child: &Id) -> Option<Self>

Source§

impl DataKey for usize

Source§

fn make_id(&self, parent: &Id) -> Id

Source§

fn reconstruct_key(parent: &Id, child: &Id) -> Option<Self>

Implementors§