Mode::seal
This commit is contained in:
parent
5dff836c58
commit
4a762dd00f
@ -14,6 +14,8 @@ pub trait Mode {
|
||||
result: Self::ParseResult<A0, E, I>,
|
||||
f: impl FnOnce(A0) -> Result<A1, E>,
|
||||
) -> Self::ParseResult<A1, E, I>;
|
||||
|
||||
fn seal<A, E, I>(result: Self::ParseResult<A, E, I>) -> Result<A, E>;
|
||||
}
|
||||
|
||||
pub trait ParseMode {
|
||||
@ -79,6 +81,10 @@ impl Mode for RegularMode {
|
||||
) -> Self::ParseResult<A1, E, I> {
|
||||
result.and_then(f)
|
||||
}
|
||||
|
||||
fn seal<A, E, I>(result: Self::ParseResult<A, E, I>) -> Result<A, E> {
|
||||
result
|
||||
}
|
||||
}
|
||||
|
||||
pub trait RegularFactory<'a, Ctx: Context<'a>>:
|
||||
|
@ -20,6 +20,10 @@ impl Mode for InliningMode {
|
||||
let a1 = f(a0)?;
|
||||
Ok((a1, i))
|
||||
}
|
||||
|
||||
fn seal<A, E, I>(result: Self::ParseResult<A, E, I>) -> Result<A, E> {
|
||||
result.map(|(a, _)| a)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, Ctx: Context<'a>, F: InlineableFactory<'a, Ctx>> FactoryProxy<'a, Ctx>
|
||||
|
Loading…
Reference in New Issue
Block a user