input: add InputMap; dsl/output/tui: Atom->Dsl
Some checks are pending
/ build (push) Waiting to run

This commit is contained in:
🪞👃🪞 2025-04-28 04:49:00 +03:00
parent 47b7f7e7f9
commit 35ad371205
15 changed files with 374 additions and 277 deletions

View file

@ -31,7 +31,7 @@ macro_rules! transform_xy {
#[inline] pub const fn xy (item: T) -> Self { Self::XY(item) }
}
#[cfg(feature = "dsl")]
impl<'a, E: Output + 'a, T: ViewContext<'a, E>> TryFromAtom<'a, T>
impl<'a, E: Output + 'a, T: ViewContext<'a, E>> TryFromDsl<'a, T>
for $Enum<RenderBox<'a, E>> {
fn try_from_expr (state: &'a T, iter: TokenIter<'a>) -> Option<Self> {
let mut iter = iter.clone();
@ -78,7 +78,7 @@ macro_rules! transform_xy_unit {
#[inline] pub const fn xy (x: U, y: U, item: T) -> Self { Self::XY(x, y, item) }
}
#[cfg(feature = "dsl")]
impl<'a, E: Output + 'a, T: ViewContext<'a, E>> TryFromAtom<'a, T>
impl<'a, E: Output + 'a, T: ViewContext<'a, E>> TryFromDsl<'a, T>
for $Enum<E::Unit, RenderBox<'a, E>> {
fn try_from_expr (state: &'a T, iter: TokenIter<'a>) -> Option<Self> {
let mut iter = iter.clone();

View file

@ -1,5 +1,6 @@
use crate::*;
use std::ops::Deref;
/// Render target.
pub trait Output: Send + Sync + Sized {
/// Unit of length

View file

@ -79,8 +79,8 @@ pub trait ViewContext<'a, E: Output + 'a>: Send + Sync
#[cfg(feature = "dsl")]
#[macro_export] macro_rules! try_delegate {
($s:ident, $atom:expr, $T:ty) => {
if let Some(value) = <$T>::try_from_atom($s, $atom) {
($s:ident, $dsl:expr, $T:ty) => {
if let Some(value) = <$T>::try_from_atom($s, $dsl) {
return Some(value.boxed())
}
}
@ -89,7 +89,7 @@ pub trait ViewContext<'a, E: Output + 'a>: Send + Sync
#[cfg(feature = "dsl")]
#[macro_export] macro_rules! try_from_expr {
(<$l:lifetime, $E:ident>: $Struct:ty: |$state:ident, $iter:ident|$body:expr) => {
impl<$l, $E: Output + $l, T: ViewContext<$l, $E>> TryFromAtom<$l, T> for $Struct {
impl<$l, $E: Output + $l, T: ViewContext<$l, $E>> TryFromDsl<$l, T> for $Struct {
fn try_from_expr ($state: &$l T, $iter: TokenIter<'a>) -> Option<Self> {
let mut $iter = $iter.clone();
$body;