wip: finally, informative type errors from the macro
Some checks failed
/ build (push) Has been cancelled

fixin mixin
This commit is contained in:
🪞👃🪞 2025-05-21 15:54:25 +03:00
parent abc87d3234
commit 583660c330
10 changed files with 152 additions and 205 deletions

View file

@ -9,18 +9,15 @@ impl<A, B> Either<A, B> {
}
}
#[cfg(feature = "dsl")]
impl<A, B, T: Dsl<bool> + Dsl<A> + Dsl<B>> Namespace<T> for Either<A, B> {
fn take_from <'source> (
state: &T,
token: &mut TokenIter<'source>
) -> Perhaps<Self> {
impl<'n, State: Receive<bool> + Receive<A> + Receive<B>, A: 'n, B: 'n> Provide<'n, State> for Either<A, B> {
fn provide <'source> (state: &State, token: &mut TokenIter<'source>) -> Perhaps<Self> {
if let Some(Token { value: Value::Key("either"), .. }) = token.peek() {
let base = token.clone();
let _ = token.next().unwrap();
return Ok(Some(Self(
state.take_or_fail(token, ||"either: no condition")?,
state.take_or_fail(token, ||"either: no content 1")?,
state.take_or_fail(token, ||"either: no content 2")?,
state.receive_or_fail(token, ||"either: no condition")?,
state.receive_or_fail(token, ||"either: no content 1")?,
state.receive_or_fail(token, ||"either: no content 2")?,
)))
}
Ok(None)