mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 04:06:45 +01:00
wip: more edn rendering setup
This commit is contained in:
parent
174a7ee614
commit
f1b3fc0040
10 changed files with 85 additions and 47 deletions
|
|
@ -14,14 +14,27 @@ impl<T> Default for EdnItem<T> {
|
|||
}
|
||||
impl<T: Debug> Debug for EdnItem<T> {
|
||||
fn fmt (&self, f: &mut Formatter<'_>) -> Result<(), FormatError> {
|
||||
use EdnItem::*;
|
||||
match self {
|
||||
Self::Nil => write!(f, "Nil"),
|
||||
Self::Num(u) => write!(f, "Num({u})"),
|
||||
Self::Sym(u) => write!(f, "Sym({u:?})"),
|
||||
Self::Key(u) => write!(f, "Key({u:?})"),
|
||||
Self::Exp(e) => write!(f, "Exp({})", itertools::join(
|
||||
e.iter().map(|i|format!("{:?}", i)), ","
|
||||
))
|
||||
Nil => write!(f, "Nil"),
|
||||
Num(u) => write!(f, "Num({u})"),
|
||||
Sym(u) => write!(f, "Sym({u:?})"),
|
||||
Key(u) => write!(f, "Key({u:?})"),
|
||||
Exp(e) => write!(f, "Exp({})",
|
||||
itertools::join(e.iter().map(|i|format!("{:?}", i)), ","))
|
||||
}
|
||||
}
|
||||
}
|
||||
impl<T: PartialEq> PartialEq for EdnItem<T> {
|
||||
fn eq (&self, other: &Self) -> bool {
|
||||
use EdnItem::*;
|
||||
match (self, other) {
|
||||
(Nil, Nil) => true,
|
||||
(Num(a), Num(b)) => a == b,
|
||||
(Sym(a), Sym(b)) => a == b,
|
||||
(Key(a), Key(b)) => a == b,
|
||||
(Exp(a), Exp(b)) => a == b,
|
||||
_ => false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue