simpler StackNodeFactory::deserialize
This commit is contained in:
parent
24d10c7f54
commit
7dbc734c53
@ -75,18 +75,13 @@ impl<'a, Ctx: Context<'a>, F: Factory<'a, Ctx>> Factory<'a, Ctx> for StackNodeFa
|
|||||||
type ParseError = StackParseError<ParseError<'a, Ctx, F>>;
|
type ParseError = StackParseError<ParseError<'a, Ctx, F>>;
|
||||||
|
|
||||||
fn deserialize(&self, dectx: &mut dyn DeCtx<'a, Ctx>) -> ParseResult<'a, Ctx, Self> {
|
fn deserialize(&self, dectx: &mut dyn DeCtx<'a, Ctx>) -> ParseResult<'a, Ctx, Self> {
|
||||||
let rest = match NullableFactory::new(self.clone()).deserialize(dectx) {
|
let rest = NullableFactory::new(self.clone())
|
||||||
Ok(rest) => rest,
|
.deserialize(dectx)
|
||||||
Err(ppe) => {
|
.map_err(StackParseError::Point)?;
|
||||||
return Err(StackParseError::Point(ppe));
|
let element = self
|
||||||
}
|
.element_factory
|
||||||
};
|
.deserialize(dectx)
|
||||||
let element = match self.element_factory.deserialize(dectx) {
|
.map_err(StackParseError::Element)?;
|
||||||
Ok(element) => element,
|
|
||||||
Err(epe) => {
|
|
||||||
return Err(StackParseError::Element(epe));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
Ok(StackNode { rest, element })
|
Ok(StackNode { rest, element })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user