use crate::IsLessThan;
use crate::skiplist::{Index, SkipList};
use std::fmt;
use std::fmt::Debug;
use std::ops::Deref;
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
}
}