@@ -30,16 +30,16 @@ pub trait Mutable: Container {
3030
3131/// A map is a key-value store where values may be looked up by their keys. This 
3232/// trait provides basic operations to operate on these stores. 
33- pub  trait  Map < K ,  V > :  Mutable  { 
33+ pub  trait  Map < K ,  V > :  Container  { 
3434    /// Return true if the map contains a value for the specified key 
3535     fn  contains_key ( & self ,  key :  & K )  -> bool ; 
3636
3737    /// Return a reference to the value corresponding to the key 
3838     fn  find < ' a > ( & ' a  self ,  key :  & K )  -> Option < & ' a  V > ; 
39+ } 
3940
40-     /// Return a mutable reference to the value corresponding to the key 
41-      fn  find_mut < ' a > ( & ' a  mut  self ,  key :  & K )  -> Option < & ' a  mut  V > ; 
42- 
41+ /// This trait provides basic operations to modify the contents of a map. 
42+ pub  trait  MutableMap < K ,  V > :  Map < K ,  V >  + Mutable  { 
4343    /// Insert a key-value pair into the map. An existing value for a 
4444     /// key is replaced by the new value. Return true if the key did 
4545     /// not already exist in the map. 
@@ -56,23 +56,18 @@ pub trait Map<K, V>: Mutable {
5656    /// Removes a key from the map, returning the value at the key if the key 
5757     /// was previously in the map. 
5858     fn  pop ( & mut  self ,  k :  & K )  -> Option < V > ; 
59+ 
60+     /// Return a mutable reference to the value corresponding to the key 
61+      fn  find_mut < ' a > ( & ' a  mut  self ,  key :  & K )  -> Option < & ' a  mut  V > ; 
5962} 
6063
6164/// A set is a group of objects which are each distinct from one another. This 
62- /// trait represents actions which can be performed on sets to manipulate and  
63- /// iterate over  them. 
64- pub  trait  Set < T > :  Mutable  { 
65+ /// trait represents actions which can be performed on sets to iterate over  
66+ /// them. 
67+ pub  trait  Set < T > :  Container  { 
6568    /// Return true if the set contains a value 
6669     fn  contains ( & self ,  value :  & T )  -> bool ; 
6770
68-     /// Add a value to the set. Return true if the value was not already 
69-      /// present in the set. 
70-      fn  insert ( & mut  self ,  value :  T )  -> bool ; 
71- 
72-     /// Remove a value from the set. Return true if the value was 
73-      /// present in the set. 
74-      fn  remove ( & mut  self ,  value :  & T )  -> bool ; 
75- 
7671    /// Return true if the set has no elements in common with `other`. 
7772     /// This is equivalent to checking for an empty intersection. 
7873     fn  is_disjoint ( & self ,  other :  & Self )  -> bool ; 
@@ -95,3 +90,15 @@ pub trait Set<T>: Mutable {
9590    /// Visit the values representing the union 
9691     fn  union ( & self ,  other :  & Self ,  f :  & fn ( & T )  -> bool )  -> bool ; 
9792} 
93+ 
94+ /// This trait represents actions which can be performed on sets to mutate 
95+ /// them. 
96+ pub  trait  MutableSet < T > :  Set < T >  + Mutable  { 
97+     /// Add a value to the set. Return true if the value was not already 
98+      /// present in the set. 
99+      fn  insert ( & mut  self ,  value :  T )  -> bool ; 
100+ 
101+     /// Remove a value from the set. Return true if the value was 
102+      /// present in the set. 
103+      fn  remove ( & mut  self ,  value :  & T )  -> bool ; 
104+ } 
0 commit comments