mirror of
https://codeberg.org/unspeaker/tengri.git
synced 2025-12-06 11:46:42 +01:00
input: add InputMap; dsl/output/tui: Atom->Dsl
Some checks are pending
/ build (push) Waiting to run
Some checks are pending
/ build (push) Waiting to run
This commit is contained in:
parent
47b7f7e7f9
commit
35ad371205
15 changed files with 374 additions and 277 deletions
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
use crate::*;
|
||||
use std::ops::Deref;
|
||||
|
||||
/// Render target.
|
||||
pub trait Output: Send + Sync + Sized {
|
||||
/// Unit of length
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue