wip: distribute layout operator parsing

This commit is contained in:
🪞👃🪞 2025-01-13 23:21:56 +01:00
parent 4af6e011b6
commit fa70a42bad
12 changed files with 150 additions and 81 deletions

View file

@ -25,7 +25,7 @@ use crate::*;
}
/// Map EDN tokens to parameters of a given type for a given context
pub trait EdnProvide<'a, U> {
pub trait EdnProvide<'a, U>: Sized {
fn get <S: AsRef<str>> (&'a self, _edn: &'a EdnItem<S>) -> Option<U> {
None
}

View file

@ -3,11 +3,12 @@
pub(crate) use std::{fmt::{Debug, Formatter, Error as FormatError}};
mod edn_error; pub use self::edn_error::*;
mod edn_item; pub use self::edn_item::*;
mod edn_iter; pub use self::edn_iter::*;
mod edn_token; pub use self::edn_token::*;
mod edn_error; pub use self::edn_error::*;
mod edn_item; pub use self::edn_item::*;
mod edn_iter; pub use self::edn_iter::*;
mod edn_token; pub use self::edn_token::*;
mod edn_provide; pub use self::edn_provide::*;
mod try_from_edn; pub use self::try_from_edn::*;
#[cfg(test)] #[test] fn test_edn () -> Result<(), ParseError> {
use EdnItem::*;

6
edn/src/try_from_edn.rs Normal file
View file

@ -0,0 +1,6 @@
use crate::*;
pub trait TryFromEdn<'a, T>: Sized {
fn try_from_edn (state: &'a T, head: &EdnItem<&str>, tail: &'a [EdnItem<&str>]) ->
Option<Self>;
}