read explicit lifetime to FromDsl
Some checks are pending
/ build (push) Waiting to run

This commit is contained in:
🪞👃🪞 2025-05-20 22:02:51 +03:00
parent 7c1cddc759
commit 455d6d00d5
14 changed files with 252 additions and 286 deletions

View file

@ -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,