simpler StaticPairFactory::deserialize
This commit is contained in:
parent
7dbc734c53
commit
ba33f82ecb
@ -133,14 +133,12 @@ impl<'a, Ctx: Context<'a>, SP: StaticPair<'a, Ctx>> Factory<'a, Ctx>
|
|||||||
|
|
||||||
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 (fa, fb) = SP::factories(&self.factory_data);
|
let (fa, fb) = SP::factories(&self.factory_data);
|
||||||
let a: SP::A = match fa.deserialize(dectx) {
|
let a = fa
|
||||||
Ok(a) => a,
|
.deserialize(dectx)
|
||||||
Err(error) => return Err(SP::from_error_a(&self.factory_data, error)),
|
.map_err(|e| SP::from_error_a(&self.factory_data, e))?;
|
||||||
};
|
let b = fb
|
||||||
let b: SP::B = match fb.deserialize(dectx) {
|
.deserialize(dectx)
|
||||||
Ok(b) => b,
|
.map_err(|e| SP::from_error_b(&self.factory_data, e))?;
|
||||||
Err(error) => return Err(SP::from_error_b(&self.factory_data, error)),
|
|
||||||
};
|
|
||||||
Ok(StaticPairObject {
|
Ok(StaticPairObject {
|
||||||
pair: SP::from_parsed(&self.factory_data, a, b),
|
pair: SP::from_parsed(&self.factory_data, a, b),
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user