StackNodeFactory::parse_point
This commit is contained in:
parent
75d68e54ba
commit
d6c4ca11b5
@ -75,13 +75,25 @@ impl<ElementParseError: Error> Display for StackParseError<ElementParseError> {
|
||||
|
||||
impl<ElementParseError: Error> Error for StackParseError<ElementParseError> {}
|
||||
|
||||
impl<F> StackNodeFactory<F> {
|
||||
fn parse_point<'a, Ctx: Context<'a>, I: InCtx<'a, Ctx>>(
|
||||
&self,
|
||||
inctx: I,
|
||||
) -> IParseResult<'a, Ctx, NullableFactory<Self>, I>
|
||||
where
|
||||
F: Factory<'a, Ctx>,
|
||||
{
|
||||
NullableFactory::new(self.clone()).ideserialize(inctx)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, Ctx: Context<'a>, F: Factory<'a, Ctx>> Factory<'a, Ctx> for StackNodeFactory<F> {
|
||||
type Mtbl = StackNode<'a, Ctx, F::Mtbl>;
|
||||
|
||||
type ParseError = StackParseError<ParseError<'a, Ctx, F>>;
|
||||
|
||||
fn deserialize(&self, inctx: impl InCtx<'a, Ctx>) -> ParseResult<'a, Ctx, Self> {
|
||||
let (rest, inctx) = NullableFactory::new(self.clone()).ideserialize(inctx)?;
|
||||
let (rest, inctx) = self.parse_point(inctx)?;
|
||||
let element = self
|
||||
.element_factory
|
||||
.deserialize(inctx)
|
||||
@ -173,7 +185,7 @@ impl<'a, Ctx: Context<'a>, F: InlineableFactory<'a, Ctx>> InlineableFactory<'a,
|
||||
}
|
||||
|
||||
fn ideserialize<I: InCtx<'a, Ctx>>(&self, inctx: I) -> IParseResult<'a, Ctx, Self, I> {
|
||||
let (rest, inctx) = NullableFactory::new(self.clone()).ideserialize(inctx)?;
|
||||
let (rest, inctx) = self.parse_point(inctx)?;
|
||||
let (element, inctx) = self
|
||||
.element_factory
|
||||
.ideserialize(inctx)
|
||||
|
Loading…
Reference in New Issue
Block a user