None
DE
Rope & SumTree
[]
Zed Industries - Blog
// Construct a rope let mut rope = Rope :: new (); rope . struct SumTree < T : Item >( pub Arc < Node < T >>); enum Node < T : Item > { Internal { height : u8 , summary : T :: Summary , child_summaries : ArrayVec < T :: Summary , { 2 * TREE_BASE }>, child_trees : ArrayVec < SumTree < T >, { 2 * TREE_BASE }>, }, Leaf { summary : T :: Summary , items : ArrayVec < T , { 2 * TREE_BASE }>, item_summaries : ArrayVec < T :: Summary , { 2 * TREE_BASE }>, }, } trait Item : Clone { type Summary : Summary ; fn summary (& self ) -> Self :: Summary ; } Since the Rope is a SumTree and each item in the SumTree has to have a summary, here's the Summary that's associated with each node in Zed's Rope :