simplify NullableFactory::deserialize
This commit is contained in:
parent
b0077e0756
commit
540fdce02a
@ -56,13 +56,7 @@ impl<'a, Ctx: Context<'a>, F: Factory<'a, Ctx>> Factory<'a, Ctx> for NullableFac
|
||||
type ParseError = PointParseError;
|
||||
|
||||
fn deserialize(&self, inctx: impl InCtx<'a, Ctx>) -> ParseResult<'a, Ctx, Self> {
|
||||
let factory = self.factory.clone();
|
||||
let (address, inctx) = inctx.icnext_address(|slice| PointParseError::from(slice))?;
|
||||
Ok(if address.point == HASH_ZEROS {
|
||||
Nullable::Null(factory)
|
||||
} else {
|
||||
Nullable::NotNull(Point::from_address(address, factory, inctx.iresolver()))
|
||||
})
|
||||
self.ideserialize(inctx).seal()
|
||||
}
|
||||
|
||||
fn extend(&self, _mentionable: Self::Mtbl, tail: &[u8]) -> ParseResult<'a, Ctx, Self> {
|
||||
|
Loading…
Reference in New Issue
Block a user