Trait kas::view::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>;
}
Available on crate feature view only.
Expand description

Bounds on the key type

Required Methods§

source

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

Make an Id for a key

The result must be distinct from parent. Use Id::make_child.

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

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl DataKey for (usize, usize)

source§

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

source§

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

source§

impl DataKey for ()

source§

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

source§

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

source§

impl DataKey for usize

source§

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

source§

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

Implementors§