mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-08 04:36:45 +01:00
wip: preparing to run groovebox from edn
This commit is contained in:
parent
ce4574ed78
commit
a6efde40f8
5 changed files with 43 additions and 28 deletions
|
|
@ -41,14 +41,20 @@ impl<T: PartialEq> PartialEq for EdnItem<T> {
|
|||
impl<T: AsRef<str> + PartialEq + Default + Clone + std::fmt::Debug> EdnItem<T> {
|
||||
pub fn to_ref (&self) -> EdnItem<&str> {
|
||||
match self {
|
||||
Self::Nil => EdnItem::Nil,
|
||||
Self::Num(x) => EdnItem::Num(*x),
|
||||
Self::Key(x) => EdnItem::Key(x.as_ref()),
|
||||
_ => todo!()
|
||||
Self::Sym(x) => EdnItem::Sym(x.as_ref()),
|
||||
Self::Exp(x) => EdnItem::Exp(x.iter().map(|x|x.to_ref()).collect::<Vec<_>>()),
|
||||
}
|
||||
}
|
||||
pub fn to_str (&self) -> &str {
|
||||
match self {
|
||||
Self::Nil => "",
|
||||
Self::Num(_) => "",
|
||||
Self::Key(x) => x.as_ref(),
|
||||
_ => todo!()
|
||||
Self::Sym(x) => x.as_ref(),
|
||||
Self::Exp(_) => "",
|
||||
}
|
||||
}
|
||||
pub fn symbols <'a> (&'a self) -> EdnIterator<'a, T> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue