mirror of
https://codeberg.org/unspeaker/tengri.git
synced 2025-12-07 04:06:48 +01:00
This commit is contained in:
parent
7c1cddc759
commit
455d6d00d5
14 changed files with 252 additions and 286 deletions
|
|
@ -33,8 +33,8 @@ macro_rules! transform_xy {
|
|||
#[inline] pub const fn xy (item: A) -> Self { Self::XY(item) }
|
||||
}
|
||||
#[cfg(feature = "dsl")]
|
||||
impl<A, T: Dsl<A>> FromDsl<T> for $Enum<A> {
|
||||
fn take_from <'state, 'source: 'state> (state: &'state T, iter: &mut TokenIter<'source>) -> Perhaps<Self> {
|
||||
impl<'source, A, T: Dsl<A>> FromDsl<'source, T> for $Enum<A> {
|
||||
fn take_from <'state> (state: &'state T, iter: &mut TokenIter<'source>) -> Perhaps<Self> {
|
||||
if let Some(Token { value: Value::Key(k), .. }) = iter.peek() {
|
||||
let mut base = iter.clone();
|
||||
return Ok(Some(match iter.next() {
|
||||
|
|
@ -51,7 +51,7 @@ macro_rules! transform_xy {
|
|||
}
|
||||
}
|
||||
impl<E: Output, T: Content<E>> Content<E> for $Enum<T> {
|
||||
fn content (&self) -> impl Render<E> {
|
||||
fn content (&self) -> impl Render<E> + '_ {
|
||||
match self {
|
||||
Self::X(item) => item,
|
||||
Self::Y(item) => item,
|
||||
|
|
@ -77,8 +77,8 @@ macro_rules! transform_xy_unit {
|
|||
#[inline] pub const fn xy (x: U, y: U, item: A) -> Self { Self::XY(x, y, item) }
|
||||
}
|
||||
#[cfg(feature = "dsl")]
|
||||
impl<A, U: Coordinate, T: Dsl<A> + Dsl<U>> FromDsl<T> for $Enum<U, A> {
|
||||
fn take_from <'state, 'source: 'state> (state: &'state T, iter: &mut TokenIter<'source>) -> Perhaps<Self> {
|
||||
impl<'source, A, U: Coordinate, T: Dsl<A> + Dsl<U>> FromDsl<'source, T> for $Enum<U, A> {
|
||||
fn take_from <'state> (state: &'state T, iter: &mut TokenIter<'source>) -> Perhaps<Self> {
|
||||
Ok(if let Some(Token { value: Value::Key($x|$y|$xy), .. }) = iter.peek() {
|
||||
let mut base = iter.clone();
|
||||
Some(match iter.next() {
|
||||
|
|
@ -103,7 +103,7 @@ macro_rules! transform_xy_unit {
|
|||
}
|
||||
}
|
||||
impl<E: Output, T: Content<E>> Content<E> for $Enum<E::Unit, T> {
|
||||
fn content (&self) -> impl Render<E> {
|
||||
fn content (&self) -> impl Render<E> + '_ {
|
||||
Some(match self {
|
||||
Self::X(_, content) => content,
|
||||
Self::Y(_, content) => content,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue