From 8ad50fa9b1cbc0e17583fbef28fa06fd980ec88a Mon Sep 17 00:00:00 2001 From: timofey Date: Wed, 28 Jun 2023 17:21:01 +0000 Subject: [PATCH] `InliningAddresses::inext_point` --- src/rcore/addresses.rs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/rcore/addresses.rs b/src/rcore/addresses.rs index 605592c..e9e05b5 100644 --- a/src/rcore/addresses.rs +++ b/src/rcore/addresses.rs @@ -40,8 +40,8 @@ impl Addresses { } } -pub trait InliningAddresses: Inlining { - fn inext_address( +pub trait InliningAddresses: Inlining { + fn inext_address( self, addresses: &mut Addresses, err: impl FnOnce(&[u8]) -> E, @@ -54,9 +54,20 @@ pub trait InliningAddresses: Inlining { addresses.current += 1; Ok((address, deserializer)) } + + fn inext_point<'a, 'b, Ctx: Context<'a>, A: Mentionable<'a, Ctx>>( + self, + addresses: &mut Addresses, + resolver: Rc>, + factory: A::Fctr, + err: impl FnOnce(&[u8]) -> E, + ) -> Result<(Point<'a, Ctx, A>, Self), E> { + let (point, deserializer) = self.inext_address(addresses, err)?; + Ok((Point::from_address(point, factory, resolver), deserializer)) + } } -impl InliningAddresses for D {} +impl InliningAddresses for D {} fn _parse_slice<'a, Ctx: Context<'a>, A: Mentionable<'a, Ctx>>( factory: &A::Fctr,