@@ -457,7 +457,9 @@ impl<K: Clone, V: Clone> Clone for Node<K, V> {
457457/// flag: &'a Cell<bool>,
458458/// }
459459///
460- /// impl<'a> Deref<Node<uint, uint>> for Nasty<'a> {
460+ /// impl<'a> Deref for Nasty<'a> {
461+ /// type Target = Node<uint, uint>;
462+ ///
461463/// fn deref(&self) -> &Node<uint, uint> {
462464/// if self.flag.get() {
463465/// &*self.second
@@ -513,7 +515,7 @@ impl<K: Ord, V> Node<K, V> {
513515 /// Searches for the given key in the node. If it finds an exact match,
514516 /// `Found` will be yielded with the matching index. If it doesn't find an exact match,
515517 /// `GoDown` will be yielded with the index of the subtree the key must lie in.
516- pub fn search < Sized ? Q , NodeRef : Deref < Node < K , V > > > ( node : NodeRef , key : & Q )
518+ pub fn search < Sized ? Q , NodeRef : Deref < Target = Node < K , V > > > ( node : NodeRef , key : & Q )
517519 -> SearchResult < NodeRef > where Q : BorrowFrom < K > + Ord {
518520 // FIXME(Gankro): Tune when to search linear or binary based on B (and maybe K/V).
519521 // For the B configured as of this writing (B = 6), binary search was *significantly*
@@ -590,7 +592,7 @@ impl <K, V> Node<K, V> {
590592 }
591593}
592594
593- impl < K , V , NodeRef : Deref < Node < K , V > > , Type , NodeType > Handle < NodeRef , Type , NodeType > {
595+ impl < K , V , NodeRef : Deref < Target = Node < K , V > > , Type , NodeType > Handle < NodeRef , Type , NodeType > {
594596 /// Returns a reference to the node that contains the pointed-to edge or key/value pair. This
595597 /// is very different from `edge` and `edge_mut` because those return children of the node
596598 /// returned by `node`.
@@ -599,7 +601,9 @@ impl<K, V, NodeRef: Deref<Node<K, V>>, Type, NodeType> Handle<NodeRef, Type, Nod
599601 }
600602}
601603
602- impl < K , V , NodeRef : DerefMut < Node < K , V > > , Type , NodeType > Handle < NodeRef , Type , NodeType > {
604+ impl < K , V , NodeRef , Type , NodeType > Handle < NodeRef , Type , NodeType > where
605+ NodeRef : Deref < Target =Node < K , V > > + DerefMut ,
606+ {
603607 /// Converts a handle into one that stores the same information using a raw pointer. This can
604608 /// be useful in conjunction with `from_raw` when the type system is insufficient for
605609 /// determining the lifetimes of the nodes.
@@ -655,7 +659,7 @@ impl<'a, K: 'a, V: 'a> Handle<&'a mut Node<K, V>, handle::Edge, handle::Internal
655659 }
656660}
657661
658- impl < K , V , NodeRef : Deref < Node < K , V > > > Handle < NodeRef , handle:: Edge , handle:: Internal > {
662+ impl < K , V , NodeRef : Deref < Target = Node < K , V > > > Handle < NodeRef , handle:: Edge , handle:: Internal > {
659663 // This doesn't exist because there are no uses for it,
660664 // but is fine to add, analagous to edge_mut.
661665 //
@@ -669,7 +673,7 @@ pub enum ForceResult<NodeRef, Type> {
669673 Internal ( Handle < NodeRef , Type , handle:: Internal > )
670674}
671675
672- impl < K , V , NodeRef : Deref < Node < K , V > > , Type > Handle < NodeRef , Type , handle:: LeafOrInternal > {
676+ impl < K , V , NodeRef : Deref < Target = Node < K , V > > , Type > Handle < NodeRef , Type , handle:: LeafOrInternal > {
673677 /// Figure out whether this handle is pointing to something in a leaf node or to something in
674678 /// an internal node, clarifying the type according to the result.
675679 pub fn force ( self ) -> ForceResult < NodeRef , Type > {
@@ -686,8 +690,9 @@ impl<K, V, NodeRef: Deref<Node<K, V>>, Type> Handle<NodeRef, Type, handle::LeafO
686690 }
687691 }
688692}
689-
690- impl < K , V , NodeRef : DerefMut < Node < K , V > > > Handle < NodeRef , handle:: Edge , handle:: Leaf > {
693+ impl < K , V , NodeRef > Handle < NodeRef , handle:: Edge , handle:: Leaf > where
694+ NodeRef : Deref < Target =Node < K , V > > + DerefMut ,
695+ {
691696 /// Tries to insert this key-value pair at the given index in this leaf node
692697 /// If the node is full, we have to split it.
693698 ///
@@ -719,7 +724,9 @@ impl<K, V, NodeRef: DerefMut<Node<K, V>>> Handle<NodeRef, handle::Edge, handle::
719724 }
720725}
721726
722- impl < K , V , NodeRef : DerefMut < Node < K , V > > > Handle < NodeRef , handle:: Edge , handle:: Internal > {
727+ impl < K , V , NodeRef > Handle < NodeRef , handle:: Edge , handle:: Internal > where
728+ NodeRef : Deref < Target =Node < K , V > > + DerefMut ,
729+ {
723730 /// Returns a mutable reference to the edge pointed-to by this handle. This should not be
724731 /// confused with `node`, which references the parent node of what is returned here.
725732 pub fn edge_mut ( & mut self ) -> & mut Node < K , V > {
@@ -802,7 +809,9 @@ impl<K, V, NodeRef: DerefMut<Node<K, V>>> Handle<NodeRef, handle::Edge, handle::
802809 }
803810}
804811
805- impl < K , V , NodeRef : DerefMut < Node < K , V > > , NodeType > Handle < NodeRef , handle:: Edge , NodeType > {
812+ impl < K , V , NodeRef , NodeType > Handle < NodeRef , handle:: Edge , NodeType > where
813+ NodeRef : Deref < Target =Node < K , V > > + DerefMut ,
814+ {
806815 /// Gets the handle pointing to the key/value pair just to the left of the pointed-to edge.
807816 /// This is unsafe because the handle might point to the first edge in the node, which has no
808817 /// pair to its left.
@@ -864,7 +873,7 @@ impl<'a, K: 'a, V: 'a, NodeType> Handle<&'a mut Node<K, V>, handle::KV, NodeType
864873 }
865874}
866875
867- impl < ' a , K : ' a , V : ' a , NodeRef : Deref < Node < K , V > > + ' a , NodeType > Handle < NodeRef , handle:: KV ,
876+ impl < ' a , K : ' a , V : ' a , NodeRef : Deref < Target = Node < K , V > > + ' a , NodeType > Handle < NodeRef , handle:: KV ,
868877 NodeType > {
869878 // These are fine to include, but are currently unneeded.
870879 //
@@ -883,8 +892,9 @@ impl<'a, K: 'a, V: 'a, NodeRef: Deref<Node<K, V>> + 'a, NodeType> Handle<NodeRef
883892 // }
884893}
885894
886- impl < ' a , K : ' a , V : ' a , NodeRef : DerefMut < Node < K , V > > + ' a , NodeType > Handle < NodeRef , handle:: KV ,
887- NodeType > {
895+ impl < ' a , K : ' a , V : ' a , NodeRef , NodeType > Handle < NodeRef , handle:: KV , NodeType > where
896+ NodeRef : ' a + Deref < Target =Node < K , V > > + DerefMut ,
897+ {
888898 /// Returns a mutable reference to the key pointed-to by this handle. This doesn't return a
889899 /// reference with a lifetime as large as `into_kv_mut`, but it also does not consume the
890900 /// handle.
@@ -900,7 +910,9 @@ impl<'a, K: 'a, V: 'a, NodeRef: DerefMut<Node<K, V>> + 'a, NodeType> Handle<Node
900910 }
901911}
902912
903- impl < K , V , NodeRef : DerefMut < Node < K , V > > , NodeType > Handle < NodeRef , handle:: KV , NodeType > {
913+ impl < K , V , NodeRef , NodeType > Handle < NodeRef , handle:: KV , NodeType > where
914+ NodeRef : Deref < Target =Node < K , V > > + DerefMut ,
915+ {
904916 /// Gets the handle pointing to the edge immediately to the left of the key/value pair pointed
905917 /// to by this handle.
906918 pub fn left_edge < ' a > ( & ' a mut self ) -> Handle < & ' a mut Node < K , V > , handle:: Edge , NodeType > {
@@ -920,7 +932,9 @@ impl<K, V, NodeRef: DerefMut<Node<K, V>>, NodeType> Handle<NodeRef, handle::KV,
920932 }
921933}
922934
923- impl < K , V , NodeRef : DerefMut < Node < K , V > > > Handle < NodeRef , handle:: KV , handle:: Leaf > {
935+ impl < K , V , NodeRef > Handle < NodeRef , handle:: KV , handle:: Leaf > where
936+ NodeRef : Deref < Target =Node < K , V > > + DerefMut ,
937+ {
924938 /// Removes the key/value pair at the handle's location.
925939 ///
926940 /// # Panics (in debug build)
@@ -931,7 +945,9 @@ impl<K, V, NodeRef: DerefMut<Node<K, V>>> Handle<NodeRef, handle::KV, handle::Le
931945 }
932946}
933947
934- impl < K , V , NodeRef : DerefMut < Node < K , V > > > Handle < NodeRef , handle:: KV , handle:: Internal > {
948+ impl < K , V , NodeRef > Handle < NodeRef , handle:: KV , handle:: Internal > where
949+ NodeRef : Deref < Target =Node < K , V > > + DerefMut
950+ {
935951 /// Steal! Stealing is roughly analogous to a binary tree rotation.
936952 /// In this case, we're "rotating" right.
937953 unsafe fn steal_rightward ( & mut self ) {
0 commit comments