From 8d435044cc84a8b4be82a8d01c4df9901c6c9219 Mon Sep 17 00:00:00 2001 From: timofey Date: Fri, 26 May 2023 11:33:20 +0000 Subject: [PATCH] `flow` docs --- src/flow/binary.rs | 8 ++++++++ src/flow/traversible/algorithms.rs | 5 +++++ src/flow/traversible/unbalanced.rs | 4 ++++ 3 files changed, 17 insertions(+) diff --git a/src/flow/binary.rs b/src/flow/binary.rs index 5e1f645..914e1da 100644 --- a/src/flow/binary.rs +++ b/src/flow/binary.rs @@ -8,6 +8,7 @@ pub type TreeRc<'a, BT> = Rc<>::Tree>; pub type KeyRc<'a, BT> = Rc<>::Key>; pub type Split<'a, BT> = (TreeRc<'a, BT>, TreeRc<'a, BT>, KeyRc<'a, BT>); +pub type KeySplit<'a, BT> = (TreeRc<'a, BT>, TreeRc<'a, BT>); pub type Wrapped<'a, BT, A> = Wrap<'a, A, >::T>; @@ -27,4 +28,11 @@ pub trait BinaryTrees<'a>: 'a { fn resolve(reference: Self::Reference) -> Wrapped<'a, Self, NodeRc<'a, Self>>; fn equal(rhs: Self::Reference, lhs: Self::Reference) -> bool; fn refer(tree: Self::Tree) -> Option>; + fn join_key( + tl: Self::Tree, + key: KeyRc<'a, Self>, + tr: Self::Tree, + ) -> Wrapped<'a, Self, TreeRc<'a, Self>>; + fn join(tl: Self::Tree, tr: Self::Tree) -> Wrapped<'a, Self, TreeRc<'a, Self>>; + fn split_key(tree: Self::Tree, key: KeyRc<'a, Self>) -> Wrapped<'a, Self, KeySplit<'a, Self>>; } diff --git a/src/flow/traversible/algorithms.rs b/src/flow/traversible/algorithms.rs index 5b12cee..20979f4 100644 --- a/src/flow/traversible/algorithms.rs +++ b/src/flow/traversible/algorithms.rs @@ -1,2 +1,7 @@ +//! Algorithms defined on traversible trees. +//! +//! These algorithms are restricted to queries given that the traits don't provide any way of +//! making new nodes. + pub mod contains; pub mod subset; diff --git a/src/flow/traversible/unbalanced.rs b/src/flow/traversible/unbalanced.rs index f015668..f42ae0f 100644 --- a/src/flow/traversible/unbalanced.rs +++ b/src/flow/traversible/unbalanced.rs @@ -1,3 +1,7 @@ +//! Binary trees without balancing. +//! +//! Intended for testing. + use std::fmt::Display; use crate::func::*;