From e31945dedafc21d6490b6c2628f9f5aa6b435930 Mon Sep 17 00:00:00 2001
From: timofey <tim@ongoteam.yaconnect.com>
Date: Fri, 30 Jun 2023 21:12:32 +0000
Subject: [PATCH] `TreeFactory` inlineable

---
 src/rstd/collections/tree.rs | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

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<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 {