trait_group! {
    pub trait TrieKey : std::marker::Copy + std::fmt::Display + Sized
}

pub struct TrieNode<KEY>
where
    KEY: TrieKey,
{
    pub key: Option<KEY>,
    pub prev: Option<usize>,
    pub next: Option<usize>,
    pub child: Option<usize>,
    pub parent: Option<usize>,
    pub(crate) ref_count: usize,
}

impl<KEY> TrieNode<KEY>
where
    KEY: TrieKey,
{
    fn new(
        key: Option<KEY>,
        prev: Option<usize>,
        next: Option<usize>,
        parent: Option<usize>,
        child: Option<usize>,
    ) -> TrieNode<KEY> {
        TrieNode {
            key,
            prev,
            next,
            child,
            parent,
            ref_count: 0,
        }
    }

    pub(crate) fn new0(key: Option<KEY>) -> TrieNode<KEY> {
        TrieNode::new(key, None, None, None, None)
    }
}
