diff --git a/src/rstd/collections/tree.rs b/src/rstd/collections/tree.rs index 7333134..a02ee5e 100644 --- a/src/rstd/collections/tree.rs +++ b/src/rstd/collections/tree.rs @@ -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 { + fn extension_error(&self, tail: &[u8]) -> Self::ParseError { + u64::a_extension_error(tail).into() + } + + fn ideserialize>(&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 {