Inlining
for Demoted
This commit is contained in:
parent
62b631d33d
commit
f8a8620aff
@ -1,3 +1,23 @@
|
||||
use super::*;
|
||||
|
||||
pub struct Demoted<'a: 'c, 'c, Ctx: Context<'a>>(pub(super) &'c mut dyn DeCtx<'a, Ctx>);
|
||||
|
||||
impl<'a: 'c, 'c, Ctx: Context<'a>> Inlining for Demoted<'a, 'c, Ctx> {
|
||||
fn iread_n<A, E>(
|
||||
self,
|
||||
n: usize,
|
||||
ok: impl FnOnce(&[u8]) -> A,
|
||||
err: impl FnOnce(&[u8]) -> E,
|
||||
) -> Result<(A, Self), E> {
|
||||
let (a, dectx) = self.0.iread_n(n, ok, err)?;
|
||||
Ok((a, Self(dectx)))
|
||||
}
|
||||
|
||||
fn iread_all<A>(self, ok: impl FnOnce(&[u8]) -> A) -> A {
|
||||
self.0.iread_all(ok)
|
||||
}
|
||||
|
||||
fn itell(&self) -> usize {
|
||||
self.0.itell()
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user