move InCtx for DeCtx
to rcore
This commit is contained in:
parent
e9e7ffb57d
commit
749268f438
@ -17,3 +17,17 @@ pub trait InCtx<'a, Ctx: Context<'a>>: Inlining {
|
|||||||
|
|
||||||
fn iresolver(&self) -> Rc<dyn Resolver<'a, Ctx>>;
|
fn iresolver(&self) -> Rc<dyn Resolver<'a, Ctx>>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<'a: 'c, 'c, Ctx: Context<'a>> InCtx<'a, Ctx> for &'c mut dyn DeCtx<'a, Ctx> {
|
||||||
|
fn icnext_address<E>(self, err: impl FnOnce(&[u8]) -> E) -> Result<(Address, Self), E> {
|
||||||
|
let (addresses, deserialiser, _) = self.adr();
|
||||||
|
match deserialiser.inext_address(addresses, err) {
|
||||||
|
Ok((address, _)) => Ok((address, self)),
|
||||||
|
Err(e) => Err(e),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn iresolver(&self) -> Rc<dyn Resolver<'a, Ctx>> {
|
||||||
|
self.resolver()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -56,20 +56,6 @@ impl<'a: 'c, 'c, Ctx: Context<'a>> Inlining for &'c mut dyn DeCtx<'a, Ctx> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a: 'c, 'c, Ctx: Context<'a>> InCtx<'a, Ctx> for &'c mut dyn DeCtx<'a, Ctx> {
|
|
||||||
fn icnext_address<E>(self, err: impl FnOnce(&[u8]) -> E) -> Result<(Address, Self), E> {
|
|
||||||
let (addresses, deserialiser, _) = self.adr();
|
|
||||||
match deserialiser.inext_address(addresses, err) {
|
|
||||||
Ok((address, _)) => Ok((address, self)),
|
|
||||||
Err(e) => Err(e),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn iresolver(&self) -> Rc<dyn Resolver<'a, Ctx>> {
|
|
||||||
self.resolver()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub type ResultDyn<A, I> = Result<(A, I), Vec<u8>>;
|
pub type ResultDyn<A, I> = Result<(A, I), Vec<u8>>;
|
||||||
|
|
||||||
pub trait InCtxDyn<'a: 'c, 'c, Ctx: Context<'a>>: 'c {
|
pub trait InCtxDyn<'a: 'c, 'c, Ctx: Context<'a>>: 'c {
|
||||||
|
Loading…
Reference in New Issue
Block a user