mirror of
https://codeberg.org/unspeaker/tengri.git
synced 2025-12-06 03:36:42 +01:00
This commit is contained in:
parent
2048dd2263
commit
776cea6f1b
9 changed files with 126 additions and 108 deletions
|
|
@ -1,30 +1,29 @@
|
||||||
use crate::*;
|
use crate::*;
|
||||||
|
|
||||||
pub trait Dsl<Other> {
|
pub trait Dsl<Type> {
|
||||||
fn take <'state, 'source: 'state> (
|
fn take <'source> (&self, token: &mut TokenIter<'source>) -> Perhaps<Type>;
|
||||||
&'state self,
|
fn take_or_fail <'source> (
|
||||||
token: &mut TokenIter<'source>
|
&self, token: &mut TokenIter<'source>, error: impl Into<Box<dyn std::error::Error>>
|
||||||
)
|
) -> Usually<Type> {
|
||||||
-> Perhaps<Other>;
|
if let Some(value) = Dsl::<Type>::take(self, token)? {
|
||||||
fn take_or_fail <'state, 'source: 'state> (
|
|
||||||
&'state self,
|
|
||||||
token: &mut TokenIter<'source>,
|
|
||||||
error: impl Into<Box<dyn std::error::Error>>
|
|
||||||
) -> Usually<Other> {
|
|
||||||
if let Some(value) = Dsl::<Other>::take(self, token)? {
|
|
||||||
Ok(value)
|
Ok(value)
|
||||||
} else {
|
} else {
|
||||||
Result::Err(error.into())
|
Result::Err(error.into())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pub trait Namespace<'source, State>: Sized {
|
|
||||||
fn take_from <'state> (state: &'state State, token: &mut TokenIter<'source>)
|
impl<Type: Namespace<State>, State> Dsl<Type> for State {
|
||||||
|
fn take <'source> (&self, token: &mut TokenIter<'source>) -> Perhaps<Type> {
|
||||||
|
Namespace::take_from(self, token)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub trait Namespace<State>: Sized {
|
||||||
|
fn take_from <'source> (state: &State, token: &mut TokenIter<'source>)
|
||||||
-> Perhaps<Self>;
|
-> Perhaps<Self>;
|
||||||
fn take_from_or_fail <'state> (
|
fn take_from_or_fail <'source> (
|
||||||
state: &'state State,
|
state: &State, token: &mut TokenIter<'source>, error: impl Into<Box<dyn std::error::Error>>
|
||||||
token: &mut TokenIter<'source>,
|
|
||||||
error: impl Into<Box<dyn std::error::Error>>
|
|
||||||
) -> Usually<Self> {
|
) -> Usually<Self> {
|
||||||
if let Some(value) = Namespace::<State>::take_from(state, token)? {
|
if let Some(value) = Namespace::<State>::take_from(state, token)? {
|
||||||
Ok(value)
|
Ok(value)
|
||||||
|
|
@ -33,6 +32,7 @@ pub trait Namespace<'source, State>: Sized {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//impl<State: Dsl<T>, T> Namespace<State> for T {
|
//impl<State: Dsl<T>, T> Namespace<State> for T {
|
||||||
//fn take_from <'state, 'source: 'state> (state: &'state State, token: &mut TokenIter<'source>)
|
//fn take_from <'state, 'source: 'state> (state: &'state State, token: &mut TokenIter<'source>)
|
||||||
//-> Perhaps<Self>
|
//-> Perhaps<Self>
|
||||||
|
|
@ -45,9 +45,9 @@ pub trait Namespace<'source, State>: Sized {
|
||||||
/// specifying two types and providing an expression.
|
/// specifying two types and providing an expression.
|
||||||
#[macro_export] macro_rules! from_dsl {
|
#[macro_export] macro_rules! from_dsl {
|
||||||
(@a: $T:ty: |$state:ident, $words:ident|$expr:expr) => {
|
(@a: $T:ty: |$state:ident, $words:ident|$expr:expr) => {
|
||||||
impl<'source, State: Dsl<A>, A> Namespace<'source, State> for $T {
|
impl<State: Dsl<A>, A> Namespace<State> for $T {
|
||||||
fn take_from <'state> (
|
fn take_from <'source> (
|
||||||
$state: &'state State,
|
$state: &State,
|
||||||
$words: &mut TokenIter<'source>,
|
$words: &mut TokenIter<'source>,
|
||||||
) -> Perhaps<$T> {
|
) -> Perhaps<$T> {
|
||||||
$expr
|
$expr
|
||||||
|
|
@ -55,9 +55,9 @@ pub trait Namespace<'source, State>: Sized {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
(@ab: $T:ty: |$state:ident, $words:ident|$expr:expr) => {
|
(@ab: $T:ty: |$state:ident, $words:ident|$expr:expr) => {
|
||||||
impl<'source, State: Dsl<A> + Dsl<B>, A, B> Namespace<'source, State> for $T {
|
impl<State: Dsl<A> + Dsl<B>, A, B> Namespace<State> for $T {
|
||||||
fn take_from <'state> (
|
fn take_from <'source> (
|
||||||
$state: &'state State,
|
$state: &State,
|
||||||
$words: &mut TokenIter<'source>,
|
$words: &mut TokenIter<'source>,
|
||||||
) -> Perhaps<$T> {
|
) -> Perhaps<$T> {
|
||||||
$expr
|
$expr
|
||||||
|
|
@ -65,9 +65,9 @@ pub trait Namespace<'source, State>: Sized {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
($T:ty: |$state:ident:$S:ty, $words:ident|$expr:expr) => {
|
($T:ty: |$state:ident:$S:ty, $words:ident|$expr:expr) => {
|
||||||
impl<'source> Namespace<'source, $S> for $T {
|
impl Namespace<$S> for $T {
|
||||||
fn take_from <'state> (
|
fn take_from <'source> (
|
||||||
$state: &'state $S,
|
$state: &$S,
|
||||||
$words: &mut TokenIter<'source>,
|
$words: &mut TokenIter<'source>,
|
||||||
) -> Perhaps<$T> {
|
) -> Perhaps<$T> {
|
||||||
$expr
|
$expr
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,13 @@ use std::marker::PhantomData;
|
||||||
pub trait DslInput: Input { fn matches_dsl (&self, token: &str) -> bool; }
|
pub trait DslInput: Input { fn matches_dsl (&self, token: &str) -> bool; }
|
||||||
|
|
||||||
/// A pre-configured mapping of input events to commands.
|
/// A pre-configured mapping of input events to commands.
|
||||||
pub trait KeyMap<'source, S, C: Namespace<'source, S> + Command<S>, I: DslInput> {
|
pub trait KeyMap<'source, S, C: Namespace<S> + Command<S>, I: DslInput> {
|
||||||
/// Try to find a command that matches the current input event.
|
/// Try to find a command that matches the current input event.
|
||||||
fn keybind_resolve (&self, state: &S, input: &I) -> Perhaps<C>;
|
fn keybind_resolve (&self, state: &S, input: &I) -> Perhaps<C>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A [SourceIter] can be a [KeyMap].
|
/// A [SourceIter] can be a [KeyMap].
|
||||||
impl<'source, S, C: Namespace<'source, S> + Command<S>, I: DslInput>
|
impl<'source, S, C: Namespace<S> + Command<S>, I: DslInput>
|
||||||
KeyMap<'source, S, C, I>
|
KeyMap<'source, S, C, I>
|
||||||
for SourceIter<'source> {
|
for SourceIter<'source> {
|
||||||
fn keybind_resolve (&self, state: &S, input: &I) -> Perhaps<C> {
|
fn keybind_resolve (&self, state: &S, input: &I) -> Perhaps<C> {
|
||||||
|
|
@ -40,7 +40,7 @@ for SourceIter<'source> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A [TokenIter] can be a [KeyMap].
|
/// A [TokenIter] can be a [KeyMap].
|
||||||
impl<'source, S, C: Namespace<'source, S> + Command<S>, I: DslInput>
|
impl<'source, S, C: Namespace<S> + Command<S>, I: DslInput>
|
||||||
KeyMap<'source, S, C, I>
|
KeyMap<'source, S, C, I>
|
||||||
for TokenIter<'source> {
|
for TokenIter<'source> {
|
||||||
fn keybind_resolve (&self, state: &S, input: &I) -> Perhaps<C> {
|
fn keybind_resolve (&self, state: &S, input: &I) -> Perhaps<C> {
|
||||||
|
|
@ -74,7 +74,7 @@ pub type InputCondition<'source, S> =
|
||||||
/// which may be made available subject to given conditions.
|
/// which may be made available subject to given conditions.
|
||||||
pub struct InputMap<'source,
|
pub struct InputMap<'source,
|
||||||
S,
|
S,
|
||||||
C: Command<S> + Namespace<'source, S>,
|
C: Command<S> + Namespace<S>,
|
||||||
I: DslInput,
|
I: DslInput,
|
||||||
M: KeyMap<'source, S, C, I>
|
M: KeyMap<'source, S, C, I>
|
||||||
> {
|
> {
|
||||||
|
|
@ -84,7 +84,7 @@ pub struct InputMap<'source,
|
||||||
|
|
||||||
impl<'source,
|
impl<'source,
|
||||||
S,
|
S,
|
||||||
C: Command<S> + Namespace<'source, S>,
|
C: Command<S> + Namespace<S>,
|
||||||
I: DslInput,
|
I: DslInput,
|
||||||
M: KeyMap<'source, S, C, I>
|
M: KeyMap<'source, S, C, I>
|
||||||
> Default for InputMap<'source, S, C, I, M>{
|
> Default for InputMap<'source, S, C, I, M>{
|
||||||
|
|
@ -95,7 +95,7 @@ impl<'source,
|
||||||
|
|
||||||
impl<'source,
|
impl<'source,
|
||||||
S,
|
S,
|
||||||
C: Command<S> + Namespace<'source, S>,
|
C: Command<S> + Namespace<S>,
|
||||||
I: DslInput,
|
I: DslInput,
|
||||||
M: KeyMap<'source, S, C, I>
|
M: KeyMap<'source, S, C, I>
|
||||||
> InputMap<'source, S, C, I, M> {
|
> InputMap<'source, S, C, I, M> {
|
||||||
|
|
@ -122,7 +122,7 @@ impl<'source,
|
||||||
|
|
||||||
impl<'source,
|
impl<'source,
|
||||||
S,
|
S,
|
||||||
C: Command<S> + Namespace<'source, S>,
|
C: Command<S> + Namespace<S>,
|
||||||
I: DslInput,
|
I: DslInput,
|
||||||
M: KeyMap<'source, S, C, I>
|
M: KeyMap<'source, S, C, I>
|
||||||
> std::fmt::Debug for InputMap<'source, S, C, I, M> {
|
> std::fmt::Debug for InputMap<'source, S, C, I, M> {
|
||||||
|
|
@ -134,7 +134,7 @@ impl<'source,
|
||||||
/// An [InputMap] can be a [KeyMap].
|
/// An [InputMap] can be a [KeyMap].
|
||||||
impl<'source,
|
impl<'source,
|
||||||
S,
|
S,
|
||||||
C: Command<S> + Namespace<'source, S>,
|
C: Command<S> + Namespace<S>,
|
||||||
I: DslInput,
|
I: DslInput,
|
||||||
M: KeyMap<'source, S, C, I>
|
M: KeyMap<'source, S, C, I>
|
||||||
> KeyMap<'source, S, C, I> for InputMap<'source, S, C, I, M> {
|
> KeyMap<'source, S, C, I> for InputMap<'source, S, C, I, M> {
|
||||||
|
|
|
||||||
|
|
@ -18,9 +18,9 @@ impl<A, B> Either<A, B> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[cfg(feature = "dsl")]
|
#[cfg(feature = "dsl")]
|
||||||
impl<'source, A, T: Dsl<bool> + Dsl<A>> Namespace<'source, T> for When<A> {
|
impl<A, T: Dsl<bool> + Dsl<A>> Namespace<T> for When<A> {
|
||||||
fn take_from <'state> (
|
fn take_from <'source> (
|
||||||
state: &'state T,
|
state: &T,
|
||||||
token: &mut TokenIter<'source>
|
token: &mut TokenIter<'source>
|
||||||
) -> Perhaps<Self> {
|
) -> Perhaps<Self> {
|
||||||
Ok(if let Some(Token {
|
Ok(if let Some(Token {
|
||||||
|
|
@ -56,9 +56,9 @@ impl<E: Output, A: Render<E>> Content<E> for When<A> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[cfg(feature = "dsl")]
|
#[cfg(feature = "dsl")]
|
||||||
impl<'source, A, B, T: Dsl<bool> + Dsl<A> + Dsl<B>> Namespace<'source, T> for Either<A, B> {
|
impl<A, B, T: Dsl<bool> + Dsl<A> + Dsl<B>> Namespace<T> for Either<A, B> {
|
||||||
fn take_from <'state> (
|
fn take_from <'source> (
|
||||||
state: &'state T,
|
state: &T,
|
||||||
token: &mut TokenIter<'source>
|
token: &mut TokenIter<'source>
|
||||||
) -> Perhaps<Self> {
|
) -> Perhaps<Self> {
|
||||||
if let Some(Token { value: Value::Key("either"), .. }) = token.peek() {
|
if let Some(Token { value: Value::Key("either"), .. }) = token.peek() {
|
||||||
|
|
|
||||||
|
|
@ -33,17 +33,19 @@ macro_rules! transform_xy {
|
||||||
#[inline] pub const fn xy (item: A) -> Self { Self::XY(item) }
|
#[inline] pub const fn xy (item: A) -> Self { Self::XY(item) }
|
||||||
}
|
}
|
||||||
#[cfg(feature = "dsl")]
|
#[cfg(feature = "dsl")]
|
||||||
impl<'source, A, T: Dsl<A>> Namespace<'source, T> for $Enum<A> {
|
impl<A, T: Dsl<A>> Namespace<T> for $Enum<A> {
|
||||||
fn take_from <'state> (state: &'state T, iter: &mut TokenIter<'source>) -> Perhaps<Self> {
|
fn take_from <'source> (
|
||||||
if let Some(Token { value: Value::Key(k), .. }) = iter.peek() {
|
state: &T, token: &mut TokenIter<'source>
|
||||||
let mut base = iter.clone();
|
) -> Perhaps<Self> {
|
||||||
return Ok(Some(match iter.next() {
|
if let Some(Token { value: Value::Key(k), .. }) = token.peek() {
|
||||||
|
let mut base = token.clone();
|
||||||
|
return Ok(Some(match token.next() {
|
||||||
Some(Token{value:Value::Key($x),..}) =>
|
Some(Token{value:Value::Key($x),..}) =>
|
||||||
Self::x(state.take_or_fail(iter, "x: no content")?),
|
Self::x(state.take_or_fail(token, "x: no content")?),
|
||||||
Some(Token{value:Value::Key($y),..}) =>
|
Some(Token{value:Value::Key($y),..}) =>
|
||||||
Self::y(state.take_or_fail(iter, "y: no content")?),
|
Self::y(state.take_or_fail(token, "y: no content")?),
|
||||||
Some(Token{value:Value::Key($xy),..}) =>
|
Some(Token{value:Value::Key($xy),..}) =>
|
||||||
Self::xy(state.take_or_fail(iter, "xy: no content")?),
|
Self::xy(state.take_or_fail(token, "xy: no content")?),
|
||||||
_ => unreachable!()
|
_ => unreachable!()
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
@ -77,23 +79,25 @@ macro_rules! transform_xy_unit {
|
||||||
#[inline] pub const fn xy (x: U, y: U, item: A) -> Self { Self::XY(x, y, item) }
|
#[inline] pub const fn xy (x: U, y: U, item: A) -> Self { Self::XY(x, y, item) }
|
||||||
}
|
}
|
||||||
#[cfg(feature = "dsl")]
|
#[cfg(feature = "dsl")]
|
||||||
impl<'source, A, U: Coordinate, T: Dsl<A> + Dsl<U>> Namespace<'source, T> for $Enum<U, A> {
|
impl<A, U: Coordinate, T: Dsl<A> + Dsl<U>> Namespace<T> for $Enum<U, A> {
|
||||||
fn take_from <'state> (state: &'state T, iter: &mut TokenIter<'source>) -> Perhaps<Self> {
|
fn take_from <'source> (
|
||||||
Ok(if let Some(Token { value: Value::Key($x|$y|$xy), .. }) = iter.peek() {
|
state: &T, token: &mut TokenIter<'source>
|
||||||
let mut base = iter.clone();
|
) -> Perhaps<Self> {
|
||||||
Some(match iter.next() {
|
Ok(if let Some(Token { value: Value::Key($x|$y|$xy), .. }) = token.peek() {
|
||||||
|
let mut base = token.clone();
|
||||||
|
Some(match token.next() {
|
||||||
Some(Token { value: Value::Key($x), .. }) => Self::x(
|
Some(Token { value: Value::Key($x), .. }) => Self::x(
|
||||||
state.take_or_fail(iter, "x: no unit")?,
|
state.take_or_fail(token, "x: no unit")?,
|
||||||
state.take_or_fail(iter, "x: no content")?,
|
state.take_or_fail(token, "x: no content")?,
|
||||||
),
|
),
|
||||||
Some(Token { value: Value::Key($y), .. }) => Self::y(
|
Some(Token { value: Value::Key($y), .. }) => Self::y(
|
||||||
state.take_or_fail(iter, "y: no unit")?,
|
state.take_or_fail(token, "y: no unit")?,
|
||||||
state.take_or_fail(iter, "y: no content")?,
|
state.take_or_fail(token, "y: no content")?,
|
||||||
),
|
),
|
||||||
Some(Token { value: Value::Key($x), .. }) => Self::xy(
|
Some(Token { value: Value::Key($x), .. }) => Self::xy(
|
||||||
state.take_or_fail(iter, "xy: no unit x")?,
|
state.take_or_fail(token, "xy: no unit x")?,
|
||||||
state.take_or_fail(iter, "xy: no unit y")?,
|
state.take_or_fail(token, "xy: no unit y")?,
|
||||||
state.take_or_fail(iter, "xy: no content")?
|
state.take_or_fail(token, "xy: no content")?
|
||||||
),
|
),
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -149,9 +149,9 @@ impl ToTokens for CommandDef {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// Generated by [tengri_proc::command].
|
/// Generated by [tengri_proc::command].
|
||||||
impl<'source> ::tengri::dsl::Namespace<'source, #state> for #command_enum {
|
impl ::tengri::dsl::Namespace<#state> for #command_enum {
|
||||||
fn take_from <'state> (
|
fn take_from <'source> (
|
||||||
state: &'state #state,
|
state: &#state,
|
||||||
words: &mut ::tengri::dsl::TokenIter<'source>
|
words: &mut ::tengri::dsl::TokenIter<'source>
|
||||||
) -> Perhaps<Self> {
|
) -> Perhaps<Self> {
|
||||||
let mut words = words.clone();
|
let mut words = words.clone();
|
||||||
|
|
|
||||||
|
|
@ -85,9 +85,9 @@ impl ToTokens for ExposeImpl {
|
||||||
let values = variants.iter().map(ExposeArm::from);
|
let values = variants.iter().map(ExposeArm::from);
|
||||||
write_quote_to(out, quote! {
|
write_quote_to(out, quote! {
|
||||||
/// Generated by [tengri_proc::expose].
|
/// Generated by [tengri_proc::expose].
|
||||||
impl<'source> ::tengri::dsl::Namespace<'source, #state> for #t {
|
impl ::tengri::dsl::Namespace<#state> for #t {
|
||||||
fn take_from <'state> (
|
fn take_from <'source> (
|
||||||
state: &'state #state,
|
state: &#state,
|
||||||
words: &mut ::tengri::dsl::TokenIter<'source>
|
words: &mut ::tengri::dsl::TokenIter<'source>
|
||||||
) -> Perhaps<Self> {
|
) -> Perhaps<Self> {
|
||||||
Ok(Some(match words.next().map(|x|x.value) {
|
Ok(Some(match words.next().map(|x|x.value) {
|
||||||
|
|
|
||||||
|
|
@ -43,10 +43,15 @@ impl ToTokens for ViewDef {
|
||||||
fn to_tokens (&self, out: &mut TokenStream2) {
|
fn to_tokens (&self, out: &mut TokenStream2) {
|
||||||
let Self(ViewMeta { output }, ViewImpl { block, exposed }) = self;
|
let Self(ViewMeta { output }, ViewImpl { block, exposed }) = self;
|
||||||
let view = &block.self_ty;
|
let view = &block.self_ty;
|
||||||
|
let builtins = builtins().iter().map(|ty|write_quote(quote! {
|
||||||
|
if let Some(value) = Namespace::<#ty>::take_from(state, &mut exp.clone())? {
|
||||||
|
return Ok(Some(value.boxed()))
|
||||||
|
}
|
||||||
|
})).collect::<Vec<_>>();
|
||||||
let mut available = vec![];
|
let mut available = vec![];
|
||||||
let exposed: Vec<_> = exposed.iter().map(|(key, value)|{
|
let exposed: Vec<_> = exposed.iter().map(|(key, value)|{
|
||||||
available.push(key.clone());
|
available.push(key.clone());
|
||||||
write_quote(quote! { #key => Some(state.#value().boxed()), })
|
write_quote(quote! { #key => Some(#view::#value(state).boxed()), })
|
||||||
}).collect();
|
}).collect();
|
||||||
let available: String = available.join(", ");
|
let available: String = available.join(", ");
|
||||||
let error_msg = LitStr::new(
|
let error_msg = LitStr::new(
|
||||||
|
|
@ -70,23 +75,26 @@ impl ToTokens for ViewDef {
|
||||||
/// Gives [#view] the ability to construct the [Render]able
|
/// Gives [#view] the ability to construct the [Render]able
|
||||||
/// which might corresponds to a given [TokenStream],
|
/// which might corresponds to a given [TokenStream],
|
||||||
/// while taking [#view]'s state into consideration.
|
/// while taking [#view]'s state into consideration.
|
||||||
impl<'source> ::tengri::dsl::Namespace<'source, #view> for Box<dyn Render<#output> + 'source> {
|
impl ::tengri::dsl::Namespace<#view> for Box<dyn Render<#output>> {
|
||||||
fn take_from <'state> (
|
fn take_from <'source> (
|
||||||
state: &'state #view,
|
state: &#view,
|
||||||
words: &mut ::tengri::dsl::TokenIter<'source>,
|
words: &mut ::tengri::dsl::TokenIter<'source>
|
||||||
) -> Perhaps<Self> {
|
) -> Perhaps<Self> {
|
||||||
Ok(words.peek().and_then(|::tengri::dsl::Token{ value, .. }|match value {
|
Ok(if let Some(::tengri::dsl::Token { value, .. }) = words.peek() {
|
||||||
::tengri::dsl::Value::Exp(_, exp) => {
|
match value {
|
||||||
todo!("builtin layout ops");
|
::tengri::dsl::Value::Exp(_, exp) => {
|
||||||
//#builtins
|
//#(#builtins)*
|
||||||
None
|
None
|
||||||
},
|
},
|
||||||
::tengri::dsl::Value::Sym(sym) => match sym {
|
::tengri::dsl::Value::Sym(sym) => match sym {
|
||||||
#(#exposed)*
|
#(#exposed)*
|
||||||
|
_ => None
|
||||||
|
},
|
||||||
_ => None
|
_ => None
|
||||||
},
|
}
|
||||||
_ => None
|
} else {
|
||||||
}))
|
None
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
@ -95,19 +103,19 @@ impl ToTokens for ViewDef {
|
||||||
|
|
||||||
fn builtins () -> [TokenStream2;14] {
|
fn builtins () -> [TokenStream2;14] {
|
||||||
[
|
[
|
||||||
quote! { When::<A> },
|
quote! { When::<_> },
|
||||||
quote! { Either::<A, B> },
|
quote! { Either::<_, _> },
|
||||||
quote! { Align::<A> },
|
quote! { Align::<_> },
|
||||||
quote! { Bsp::<A, B> },
|
quote! { Bsp::<_, _> },
|
||||||
quote! { Fill::<A> },
|
quote! { Fill::<_> },
|
||||||
quote! { Fixed::<_, A> },
|
quote! { Fixed::<_, _> },
|
||||||
quote! { Min::<_, A> },
|
quote! { Min::<_, _> },
|
||||||
quote! { Max::<_, A> },
|
quote! { Max::<_, _> },
|
||||||
quote! { Shrink::<_, A> },
|
quote! { Shrink::<_, _> },
|
||||||
quote! { Expand::<_, A> },
|
quote! { Expand::<_, _> },
|
||||||
quote! { Push::<_, A> },
|
quote! { Push::<_, _> },
|
||||||
quote! { Pull::<_, A> },
|
quote! { Pull::<_, _> },
|
||||||
quote! { Margin::<_, A> },
|
quote! { Margin::<_, _> },
|
||||||
quote! { Padding::<_, A> },
|
quote! { Padding::<_, _> },
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,18 @@ macro_rules! impl_content_layout_render {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mod tui_border; pub use self::tui_border::*;
|
||||||
|
mod tui_button; pub use self::tui_button::*;
|
||||||
|
mod tui_color; pub use self::tui_color::*;
|
||||||
|
mod tui_field; pub use self::tui_field::*;
|
||||||
|
mod tui_phat; pub use self::tui_phat::*;
|
||||||
|
mod tui_repeat; pub use self::tui_repeat::*;
|
||||||
|
mod tui_number; pub use self::tui_number::*;
|
||||||
|
mod tui_scroll; pub use self::tui_scroll::*;
|
||||||
|
mod tui_string; pub use self::tui_string::*;
|
||||||
|
mod tui_style; pub use self::tui_style::*;
|
||||||
|
mod tui_tryptich; pub use self::tui_tryptich::*;
|
||||||
|
|
||||||
impl<T: Content<TuiOut>> Content<TuiOut> for std::sync::Arc<T> {
|
impl<T: Content<TuiOut>> Content<TuiOut> for std::sync::Arc<T> {
|
||||||
fn layout (&self, to: [u16;4]) -> [u16;4] {
|
fn layout (&self, to: [u16;4]) -> [u16;4] {
|
||||||
Content::<TuiOut>::layout(&**self, to)
|
Content::<TuiOut>::layout(&**self, to)
|
||||||
|
|
@ -44,14 +56,3 @@ impl<T: Content<TuiOut>> Content<TuiOut> for Result<T, Box<dyn std::error::Error
|
||||||
//}
|
//}
|
||||||
//}
|
//}
|
||||||
//}
|
//}
|
||||||
|
|
||||||
mod tui_border; pub use self::tui_border::*;
|
|
||||||
mod tui_button; pub use self::tui_button::*;
|
|
||||||
mod tui_color; pub use self::tui_color::*;
|
|
||||||
mod tui_field; pub use self::tui_field::*;
|
|
||||||
mod tui_phat; pub use self::tui_phat::*;
|
|
||||||
mod tui_repeat; pub use self::tui_repeat::*;
|
|
||||||
mod tui_scroll; pub use self::tui_scroll::*;
|
|
||||||
mod tui_string; pub use self::tui_string::*;
|
|
||||||
mod tui_style; pub use self::tui_style::*;
|
|
||||||
mod tui_tryptich; pub use self::tui_tryptich::*;
|
|
||||||
|
|
|
||||||
5
tui/src/tui_content/tui_number.rs
Normal file
5
tui/src/tui_content/tui_number.rs
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
use crate::*;
|
||||||
|
|
||||||
|
render!(TuiOut: |self: u64, to|todo!());
|
||||||
|
|
||||||
|
render!(TuiOut: |self: f64, to|todo!());
|
||||||
Loading…
Add table
Add a link
Reference in a new issue