use Demoted
in typeless
This commit is contained in:
parent
4bdac0336d
commit
35a8308e9f
@ -1,6 +1,6 @@
|
|||||||
//! Previously part of [`crate::rcore`].
|
//! Previously part of [`crate::rcore`].
|
||||||
|
|
||||||
use super::{cast::CastError, inlining::*, wrapped_origin::*, *};
|
use super::{cast::CastError, wrapped_origin::*, *};
|
||||||
|
|
||||||
type TypelessSerialize<'a> = dyn 'a + Fn(&mut dyn Serializer);
|
type TypelessSerialize<'a> = dyn 'a + Fn(&mut dyn Serializer);
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ type TypelessParsed<'a, Ctx> = Result<TypelessMentionable<'a, Ctx>, Box<dyn 'a +
|
|||||||
trait Tde<'a, Ctx: Context<'a>>: 'a + Send + Sync {
|
trait Tde<'a, Ctx: Context<'a>>: 'a + Send + Sync {
|
||||||
fn clone_box(&self) -> TdeBox<'a, Ctx>;
|
fn clone_box(&self) -> TdeBox<'a, Ctx>;
|
||||||
|
|
||||||
fn de<'c>(&self, indyn: Box<dyn InCtxDyn<'a, 'c, Ctx>>) -> TypelessParsed<'a, Ctx>
|
fn de<'c>(&self, demoted: Demoted<'a, 'c, Ctx>) -> TypelessParsed<'a, Ctx>
|
||||||
where
|
where
|
||||||
'a: 'c;
|
'a: 'c;
|
||||||
}
|
}
|
||||||
@ -93,9 +93,7 @@ impl<'a, Ctx: Context<'a>> Factory<'a, Ctx> for TypelessFactory<'a, Ctx> {
|
|||||||
type ParseError = TypelessError<'a>;
|
type ParseError = TypelessError<'a>;
|
||||||
|
|
||||||
fn deserialize(&self, inctx: impl InCtx<'a, Ctx>) -> ParseResult<'a, Ctx, Self> {
|
fn deserialize(&self, inctx: impl InCtx<'a, Ctx>) -> ParseResult<'a, Ctx, Self> {
|
||||||
self.t_deserialize
|
self.t_deserialize.de(inctx.demote()).map_err(TypelessError)
|
||||||
.de(Box::new(inctx))
|
|
||||||
.map_err(TypelessError)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn extend(&self, mentionable: Self::Mtbl, tail: &[u8]) -> ParseResult<'a, Ctx, Self> {
|
fn extend(&self, mentionable: Self::Mtbl, tail: &[u8]) -> ParseResult<'a, Ctx, Self> {
|
||||||
@ -128,11 +126,11 @@ where
|
|||||||
Box::new(self.clone())
|
Box::new(self.clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn de<'c>(&self, indyn: Box<dyn InCtxDyn<'a, 'c, Ctx>>) -> TypelessParsed<'a, Ctx>
|
fn de<'c>(&self, demoted: Demoted<'a, 'c, Ctx>) -> TypelessParsed<'a, Ctx>
|
||||||
where
|
where
|
||||||
'a: 'c,
|
'a: 'c,
|
||||||
{
|
{
|
||||||
self.deserialize(indyn)
|
self.deserialize(demoted)
|
||||||
.map_err(|e| Box::new(e) as Box<dyn 'a + Error>)
|
.map_err(|e| Box::new(e) as Box<dyn 'a + Error>)
|
||||||
.map(Rc::new)
|
.map(Rc::new)
|
||||||
.map(TypelessMentionable::from_typed)
|
.map(TypelessMentionable::from_typed)
|
||||||
|
Loading…
Reference in New Issue
Block a user