mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 04:06:45 +01:00
clone EdnItem
This commit is contained in:
parent
400fd9b6e9
commit
3dd8a7bc0d
8 changed files with 190 additions and 169 deletions
|
|
@ -38,6 +38,18 @@ impl<T: PartialEq> PartialEq for EdnItem<T> {
|
|||
}
|
||||
}
|
||||
}
|
||||
impl EdnItem<&str> {
|
||||
pub fn clone (&self) -> EdnItem<String> {
|
||||
use EdnItem::*;
|
||||
match self {
|
||||
Nil => Nil,
|
||||
Num(u) => Num(*u),
|
||||
Sym(u) => Sym(u.to_string()),
|
||||
Key(u) => Key(u.to_string()),
|
||||
Exp(e) => Exp(e.iter().map(|i|i.clone()).collect()),
|
||||
}
|
||||
}
|
||||
}
|
||||
impl<T: AsRef<str> + PartialEq + Default + Clone + std::fmt::Debug> EdnItem<T> {
|
||||
pub fn to_ref (&self) -> EdnItem<&str> {
|
||||
match self {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue