rework BinaryTrees
				
					
				
			This commit is contained in:
		
							parent
							
								
									d27a53bcb8
								
							
						
					
					
						commit
						f5791c930d
					
				| @ -12,7 +12,7 @@ pub type KeyRc<'a, BT> = Rc<<BT as BinaryTrees<'a>>::Key>; | |||||||
| pub type Split<'a, BT> = (TreeRc<'a, BT>, TreeRc<'a, BT>, KeyRc<'a, BT>); | 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 KeySplit<'a, BT> = (TreeRc<'a, BT>, TreeRc<'a, BT>); | ||||||
| 
 | 
 | ||||||
| pub type Wrapped<'a, BT, A> = Wrap<'a, A, <BT as BinaryTrees<'a>>::T>; | pub type BTWrap<'a, BT, A> = Wrap<'a, A, <BT as BinaryTrees<'a>>::T>; | ||||||
| 
 | 
 | ||||||
| pub trait BinaryTrees<'a>: 'a { | pub trait BinaryTrees<'a>: 'a { | ||||||
|     type Node: 'a; |     type Node: 'a; | ||||||
| @ -24,11 +24,11 @@ pub trait BinaryTrees<'a>: 'a { | |||||||
|     type T: Monad<'a>; |     type T: Monad<'a>; | ||||||
| 
 | 
 | ||||||
|     fn comparator(&self) -> &Self::Comparator; |     fn comparator(&self) -> &Self::Comparator; | ||||||
|     fn split(&self, node: Self::Node) -> Split<'a, Self>; |     fn split(&self, node: &Self::Node) -> Split<'a, Self>; | ||||||
|     fn to_tree(&self, node: Self::Node) -> TreeRc<'a, Self>; |     fn tree_of(&self, node: Self::Node) -> TreeRc<'a, Self>; | ||||||
|     fn resolve(&self, reference: Self::Reference) -> Wrapped<'a, Self, NodeRc<'a, Self>>; |     fn resolve(&self, reference: &Self::Reference) -> BTWrap<'a, Self, NodeRc<'a, Self>>; | ||||||
|     fn equal(&self, rhs: Self::Reference, lhs: Self::Reference) -> bool; |     fn equal(&self, rhs: &Self::Reference, lhs: &Self::Reference) -> bool; | ||||||
|     fn refer(&self, tree: Self::Tree) -> Option<ReferenceRc<'a, Self>>; |     fn refer(&self, tree: &Self::Tree) -> Option<ReferenceRc<'a, Self>>; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| pub trait BinaryTreesMutable<'a>: BinaryTrees<'a> { | pub trait BinaryTreesMutable<'a>: BinaryTrees<'a> { | ||||||
| @ -37,11 +37,11 @@ pub trait BinaryTreesMutable<'a>: BinaryTrees<'a> { | |||||||
|         tl: Self::Tree, |         tl: Self::Tree, | ||||||
|         key: KeyRc<'a, Self>, |         key: KeyRc<'a, Self>, | ||||||
|         tr: Self::Tree, |         tr: Self::Tree, | ||||||
|     ) -> Wrapped<'a, Self, NodeRc<'a, Self>>; |     ) -> BTWrap<'a, Self, NodeRc<'a, Self>>; | ||||||
|     fn join(&self, tl: Self::Tree, tr: Self::Tree) -> Wrapped<'a, Self, TreeRc<'a, Self>>; |     fn join(&self, tl: Self::Tree, tr: Self::Tree) -> BTWrap<'a, Self, TreeRc<'a, Self>>; | ||||||
|     fn split_key( |     fn split_key( | ||||||
|         &self, |         &self, | ||||||
|         tree: Self::Tree, |         tree: Self::Tree, | ||||||
|         key: KeyRc<'a, Self>, |         key: KeyRc<'a, Self>, | ||||||
|     ) -> Wrapped<'a, Self, KeySplit<'a, Self>>; |     ) -> BTWrap<'a, Self, KeySplit<'a, Self>>; | ||||||
| } | } | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user