diff --git a/src/rstd/collections/stack.rs b/src/rstd/collections/stack.rs index 27e859b..61f536b 100644 --- a/src/rstd/collections/stack.rs +++ b/src/rstd/collections/stack.rs @@ -75,13 +75,25 @@ impl Display for StackParseError { impl Error for StackParseError {} +impl StackNodeFactory { + fn parse_point<'a, Ctx: Context<'a>, I: InCtx<'a, Ctx>>( + &self, + inctx: I, + ) -> IParseResult<'a, Ctx, NullableFactory, 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 { type Mtbl = StackNode<'a, Ctx, F::Mtbl>; type ParseError = StackParseError>; 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>(&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)