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> {
|
||||
let (fa, fb) = SP::factories(&self.factory_data);
|
||||
let a: SP::A = match fa.deserialize(dectx) {
|
||||
Ok(a) => a,
|
||||
Err(error) => return Err(SP::from_error_a(&self.factory_data, error)),
|
||||
};
|
||||
let b: SP::B = match fb.deserialize(dectx) {
|
||||
Ok(b) => b,
|
||||
Err(error) => return Err(SP::from_error_b(&self.factory_data, error)),
|
||||
};
|
||||
let a = fa
|
||||
.deserialize(dectx)
|
||||
.map_err(|e| SP::from_error_a(&self.factory_data, e))?;
|
||||
let b = fb
|
||||
.deserialize(dectx)
|
||||
.map_err(|e| SP::from_error_b(&self.factory_data, e))?;
|
||||
Ok(StaticPairObject {
|
||||
pair: SP::from_parsed(&self.factory_data, a, b),
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user