From 4bdac0336d8caa0c90f202792a8e1ecd57df21d2 Mon Sep 17 00:00:00 2001 From: timofey Date: Sat, 1 Jul 2023 14:27:19 +0000 Subject: [PATCH] `InCtx` for `Demoted` --- src/rcore/demoted.rs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/rcore/demoted.rs b/src/rcore/demoted.rs index dd2f941..630410c 100644 --- a/src/rcore/demoted.rs +++ b/src/rcore/demoted.rs @@ -21,3 +21,31 @@ impl<'a: 'c, 'c, Ctx: Context<'a>> Inlining for Demoted<'a, 'c, Ctx> { self.0.itell() } } + +impl<'a: 'c, 'c, Ctx: Context<'a>> InCtx<'a, Ctx> for Demoted<'a, 'c, Ctx> { + fn icnext_address(self, err: impl FnOnce(&[u8]) -> E) -> Result<(Address, Self), E> { + let (address, dectx) = self.0.icnext_address(err)?; + Ok((address, Self(dectx))) + } + + fn icnext_point<'b, A: Mentionable<'a, Ctx>, E>( + self, + factory: A::Fctr, + err: impl FnOnce(&[u8]) -> E, + ) -> Result<(Point<'a, Ctx, A>, Self), E> { + let (point, dectx) = self.0.icnext_point(factory, err)?; + Ok((point, Self(dectx))) + } + + fn iresolver(&self) -> Rc> { + self.0.iresolver() + } + + fn demote<'d>(self) -> Demoted<'a, 'd, Ctx> + where + 'a: 'd, + Self: 'd, + { + self.0.demote() + } +}