TreeFactory
inlineable
This commit is contained in:
parent
a10447457a
commit
e31945deda
@ -7,6 +7,7 @@ use crate::{
|
||||
rcore::*,
|
||||
rstd::{
|
||||
atomic::{au64::*, *},
|
||||
inlining::*,
|
||||
nullable::*,
|
||||
point::*,
|
||||
},
|
||||
@ -172,6 +173,20 @@ impl<'a, Ctx: Context<'a>, F: Factory<'a, Ctx>> Factory<'a, Ctx> for TreeFactory
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, Ctx: Context<'a>, F: Factory<'a, Ctx>> InlineableFactory<'a, Ctx> for TreeFactory<F> {
|
||||
fn extension_error(&self, tail: &[u8]) -> Self::ParseError {
|
||||
u64::a_extension_error(tail).into()
|
||||
}
|
||||
|
||||
fn ideserialize<I: InCtx<'a, Ctx>>(&self, inctx: I) -> IParseResult<'a, Ctx, Self, I> {
|
||||
let (node, inctx) = self.0.ideserialize(inctx)?;
|
||||
let (height, inctx) = u64::a_ideserialize(inctx)?;
|
||||
let tree = Tree { node, height };
|
||||
tree.validate_height()?;
|
||||
Ok((tree, inctx))
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, Ctx: Context<'a>, A: Mentionable<'a, Ctx> + Clone> Clone for Node<'a, Ctx, A> {
|
||||
fn clone(&self) -> Self {
|
||||
Self {
|
||||
|
Loading…
Reference in New Issue
Block a user