mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-08 12:46:42 +01:00
clone EdnItem
This commit is contained in:
parent
400fd9b6e9
commit
3dd8a7bc0d
8 changed files with 190 additions and 169 deletions
|
|
@ -26,12 +26,15 @@ pub enum EdnView<E: Output, T: EdnViewData<E>> {
|
|||
}
|
||||
|
||||
impl<E: Output, T: EdnViewData<E>> EdnView<E, T> {
|
||||
pub fn new (state: T, source: &str) -> Self {
|
||||
pub fn from_source (state: T, source: &str) -> Self {
|
||||
match EdnItem::read_one(&source) {
|
||||
Ok((layout, _)) => Self::Ok(state, layout),
|
||||
Err(error) => Self::Err(format!("{error}"))
|
||||
}
|
||||
}
|
||||
pub fn from_items (state: T, items: &[EdnItem<&str>]) -> Self {
|
||||
Self::Ok(state, EdnItem::Exp(items.iter().map(|i|(*i).clone()).collect()))
|
||||
}
|
||||
}
|
||||
|
||||
impl<E: Output, T: EdnViewData<E> + Send + Sync> Content<E> for EdnView<E, T> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue