mirror of
https://codeberg.org/unspeaker/tengri.git
synced 2025-12-07 04:06:48 +01:00
wip: finally, informative type errors from the macro
Some checks failed
/ build (push) Has been cancelled
Some checks failed
/ build (push) Has been cancelled
fixin mixin
This commit is contained in:
parent
abc87d3234
commit
583660c330
10 changed files with 152 additions and 205 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue