cpp_map 0.2.0

A simple C++ std::map emulator
Documentation
use crate::IsLessThan;
use crate::skiplist::{Index, SkipList};
use std::fmt;
use std::fmt::Debug;
use std::ops::Deref;
/*// Implement for types that already have Ord
impl<T: Ord> IsLessThan for T {
    fn is_less_than(&self, other: &Self) -> bool {
        self < other
    }
}*/

impl<K, V> Default for SkipList<K, V>
where
    K: Debug + Clone + IsLessThan,
    V: Debug + Clone,
{
    fn default() -> Self {
        Self::new()
    }
}

impl fmt::Display for Index {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        write!(f, "{}", self.0)
    }
}

impl Debug for Index {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        write!(f, "{}", self.0)
    }
}

impl From<Index> for usize {
    fn from(index: Index) -> usize {
        index.0
    }
}

impl PartialEq<usize> for Index {
    #[inline(always)]
    fn eq(&self, other: &usize) -> bool {
        self.0 == *other
    }
}

impl Deref for Index {
    type Target = usize;
    #[inline(always)]
    fn deref(&self) -> &usize {
        &self.0
    }
}