From 6a4cb9504c273d10cba19f4a7b058d0458dc8a3a Mon Sep 17 00:00:00 2001 From: timofey Date: Fri, 30 Jun 2023 21:45:28 +0000 Subject: [PATCH] inlining dyn lifetimes --- src/rstd/inlining.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/rstd/inlining.rs b/src/rstd/inlining.rs index 9476662..dc05ff9 100644 --- a/src/rstd/inlining.rs +++ b/src/rstd/inlining.rs @@ -88,18 +88,18 @@ impl<'a: 'c, 'c, Ctx: Context<'a>> InCtx<'a, Ctx> for &'c mut dyn DeCtx<'a, Ctx> } } -pub trait InliningDyn { - fn idread_n(self, n: usize) -> Result<(Vec, Box), Vec>; +pub trait InliningDyn<'c>: 'c { + fn idread_n(self, n: usize) -> Result<(Vec, Box>), Vec>; fn idread_all(self) -> Vec; fn idtell(&self) -> usize; } -impl InliningDyn for I { - fn idread_n(self, n: usize) -> Result<(Vec, Box), Vec> { +impl<'c, I: 'c + Inlining> InliningDyn<'c> for I { + fn idread_n(self, n: usize) -> Result<(Vec, Box>), Vec> { let (vec, i) = self.iread_n(n, |slice| Vec::from(slice), |slice| Vec::from(slice))?; - Ok((vec, i.into())) + Ok((vec, Box::new(i))) } fn idread_all(self) -> Vec { @@ -111,16 +111,16 @@ impl InliningDyn for I { } } -pub trait InCtxDyn<'a, Ctx: Context<'a>>: InliningDyn { - fn icdnext_address(self) -> Result<(Address, Box), Vec>; +pub trait InCtxDyn<'a: 'c, 'c, Ctx: Context<'a>>: InliningDyn<'c> { + fn icdnext_address(self) -> Result<(Address, Box>), Vec>; fn idresolver(&self) -> Rc>; } -impl<'a, Ctx: Context<'a>, I: InCtx<'a, Ctx>> InCtxDyn<'a, Ctx> for I { - fn icdnext_address(self) -> Result<(Address, Box), Vec> { +impl<'a: 'c, 'c, Ctx: Context<'a>, I: 'c + InCtx<'a, Ctx>> InCtxDyn<'a, 'c, Ctx> for I { + fn icdnext_address(self) -> Result<(Address, Box>), Vec> { let (address, i) = self.icnext_address(|slice| Vec::from(slice))?; - Ok((address, i.into())) + Ok((address, Box::new(i))) } fn idresolver(&self) -> Rc> {