use crate::{DEFAULT_SEPARATOR, PermNode};
use std::{fmt::Display, hash::Hash};
impl Default for PermNode<'_> {
fn default() -> Self {
Self::new()
}
}
impl Hash for PermNode<'_> {
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
self.inter.hash(state);
for (key, value) in self.context.iter() {
(key, value).hash(state);
}
}
}
impl Display for PermNode<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let result = self.inter.join(self.divider);
return result.fmt(f);
}
}
impl<'a> From<&'a str> for PermNode<'a> {
fn from(value: &'a str) -> Self {
PermNode::from_str(value, DEFAULT_SEPARATOR)
}
}