use std::borrow::Borrow;
use std::fmt::{Debug, Display};
use std::hash::Hash;
use std::marker::PhantomData;
use std::ops::Deref;
pub trait StringStorage: Clone + Debug + Default + PartialEq + Eq + Hash {
type String: AsRef<str>
+ Deref<Target = str>
+ Eq
+ PartialEq
+ PartialOrd
+ Ord
+ Hash
+ Borrow<str>
+ Clone
+ Debug
+ Default
+ Display;
}
#[derive(Clone, Debug, Default, Eq, PartialEq, Hash, PartialOrd)]
pub struct OwnedStringStorage;
impl StringStorage for OwnedStringStorage {
type String = String;
}
#[derive(Clone, Debug, Default, Eq, PartialEq, Hash, PartialOrd)]
pub struct BorrowedStringStorage<'a>(PhantomData<&'a ()>);
impl<'a> StringStorage for BorrowedStringStorage<'a> {
type String = &'a str;
}