use crate::{Pr, Symbol};
use std::fmt::{Display, Error, Formatter};
#[derive(Debug, Clone, Default, Hash, Eq, PartialEq, Ord, PartialOrd)]
pub(crate) struct SymbolString(pub Vec<Symbol>);
impl From<&Pr> for SymbolString {
fn from(pr: &Pr) -> Self {
Self(
pr.get_r()
.iter()
.fold(Vec::with_capacity(pr.len()), |mut acc, e| {
acc.push(e.clone());
acc
}),
)
}
}
impl Display for SymbolString {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error> {
write!(
f,
"{}",
self.0
.iter()
.map(|e| format!("{e}"))
.collect::<Vec<String>>()
.join(", ")
)
}
}