@@ -19,11 +19,9 @@ use std::collections::{DList, RingBuf, BTreeMap, BTreeSet, HashMap, HashSet, Vec
1919use collections:: enum_set:: { EnumSet , CLike } ;
2020
2121impl <
22- E ,
23- S : Encoder < E > ,
24- T : Encodable < S , E >
25- > Encodable < S , E > for DList < T > {
26- fn encode ( & self , s : & mut S ) -> Result < ( ) , E > {
22+ T : Encodable
23+ > Encodable for DList < T > {
24+ fn encode < S : Encoder > ( & self , s : & mut S ) -> Result < ( ) , S :: Error > {
2725 s. emit_seq ( self . len ( ) , |s| {
2826 for ( i, e) in self . iter ( ) . enumerate ( ) {
2927 try!( s. emit_seq_elt ( i, |s| e. encode ( s) ) ) ;
3331 }
3432}
3533
36- impl < E , D : Decoder < E > , T : Decodable < D , E > > Decodable < D , E > for DList < T > {
37- fn decode ( d : & mut D ) -> Result < DList < T > , E > {
34+ impl < T : Decodable > Decodable for DList < T > {
35+ fn decode < D : Decoder > ( d : & mut D ) -> Result < DList < T > , D :: Error > {
3836 d. read_seq ( |d, len| {
3937 let mut list = DList :: new ( ) ;
4038 for i in range ( 0 u, len) {
@@ -45,12 +43,8 @@ impl<E, D:Decoder<E>,T:Decodable<D, E>> Decodable<D, E> for DList<T> {
4543 }
4644}
4745
48- impl <
49- E ,
50- S : Encoder < E > ,
51- T : Encodable < S , E >
52- > Encodable < S , E > for RingBuf < T > {
53- fn encode ( & self , s : & mut S ) -> Result < ( ) , E > {
46+ impl < T : Encodable > Encodable for RingBuf < T > {
47+ fn encode < S : Encoder > ( & self , s : & mut S ) -> Result < ( ) , S :: Error > {
5448 s. emit_seq ( self . len ( ) , |s| {
5549 for ( i, e) in self . iter ( ) . enumerate ( ) {
5650 try!( s. emit_seq_elt ( i, |s| e. encode ( s) ) ) ;
6054 }
6155}
6256
63- impl < E , D : Decoder < E > , T : Decodable < D , E > > Decodable < D , E > for RingBuf < T > {
64- fn decode ( d : & mut D ) -> Result < RingBuf < T > , E > {
57+ impl < T : Decodable > Decodable for RingBuf < T > {
58+ fn decode < D : Decoder > ( d : & mut D ) -> Result < RingBuf < T > , D :: Error > {
6559 d. read_seq ( |d, len| {
6660 let mut deque: RingBuf < T > = RingBuf :: new ( ) ;
6761 for i in range ( 0 u, len) {
@@ -73,12 +67,10 @@ impl<E, D:Decoder<E>,T:Decodable<D, E>> Decodable<D, E> for RingBuf<T> {
7367}
7468
7569impl <
76- E ,
77- S : Encoder < E > ,
78- K : Encodable < S , E > + PartialEq + Ord ,
79- V : Encodable < S , E > + PartialEq
80- > Encodable < S , E > for BTreeMap < K , V > {
81- fn encode ( & self , e : & mut S ) -> Result < ( ) , E > {
70+ K : Encodable + PartialEq + Ord ,
71+ V : Encodable + PartialEq
72+ > Encodable for BTreeMap < K , V > {
73+ fn encode < S : Encoder > ( & self , e : & mut S ) -> Result < ( ) , S :: Error > {
8274 e. emit_map ( self . len ( ) , |e| {
8375 let mut i = 0 ;
8476 for ( key, val) in self . iter ( ) {
@@ -92,12 +84,10 @@ impl<
9284}
9385
9486impl <
95- E ,
96- D : Decoder < E > ,
97- K : Decodable < D , E > + PartialEq + Ord ,
98- V : Decodable < D , E > + PartialEq
99- > Decodable < D , E > for BTreeMap < K , V > {
100- fn decode ( d : & mut D ) -> Result < BTreeMap < K , V > , E > {
87+ K : Decodable + PartialEq + Ord ,
88+ V : Decodable + PartialEq
89+ > Decodable for BTreeMap < K , V > {
90+ fn decode < D : Decoder > ( d : & mut D ) -> Result < BTreeMap < K , V > , D :: Error > {
10191 d. read_map ( |d, len| {
10292 let mut map = BTreeMap :: new ( ) ;
10393 for i in range ( 0 u, len) {
@@ -111,11 +101,9 @@ impl<
111101}
112102
113103impl <
114- E ,
115- S : Encoder < E > ,
116- T : Encodable < S , E > + PartialEq + Ord
117- > Encodable < S , E > for BTreeSet < T > {
118- fn encode ( & self , s : & mut S ) -> Result < ( ) , E > {
104+ T : Encodable + PartialEq + Ord
105+ > Encodable for BTreeSet < T > {
106+ fn encode < S : Encoder > ( & self , s : & mut S ) -> Result < ( ) , S :: Error > {
119107 s. emit_seq ( self . len ( ) , |s| {
120108 let mut i = 0 ;
121109 for e in self . iter ( ) {
@@ -128,11 +116,9 @@ impl<
128116}
129117
130118impl <
131- E ,
132- D : Decoder < E > ,
133- T : Decodable < D , E > + PartialEq + Ord
134- > Decodable < D , E > for BTreeSet < T > {
135- fn decode ( d : & mut D ) -> Result < BTreeSet < T > , E > {
119+ T : Decodable + PartialEq + Ord
120+ > Decodable for BTreeSet < T > {
121+ fn decode < D : Decoder > ( d : & mut D ) -> Result < BTreeSet < T > , D :: Error > {
136122 d. read_seq ( |d, len| {
137123 let mut set = BTreeSet :: new ( ) ;
138124 for i in range ( 0 u, len) {
@@ -144,11 +130,9 @@ impl<
144130}
145131
146132impl <
147- E ,
148- S : Encoder < E > ,
149- T : Encodable < S , E > + CLike
150- > Encodable < S , E > for EnumSet < T > {
151- fn encode ( & self , s : & mut S ) -> Result < ( ) , E > {
133+ T : Encodable + CLike
134+ > Encodable for EnumSet < T > {
135+ fn encode < S : Encoder > ( & self , s : & mut S ) -> Result < ( ) , S :: Error > {
152136 let mut bits = 0 ;
153137 for item in self . iter ( ) {
154138 bits |= item. to_uint ( ) ;
@@ -158,11 +142,9 @@ impl<
158142}
159143
160144impl <
161- E ,
162- D : Decoder < E > ,
163- T : Decodable < D , E > + CLike
164- > Decodable < D , E > for EnumSet < T > {
165- fn decode ( d : & mut D ) -> Result < EnumSet < T > , E > {
145+ T : Decodable + CLike
146+ > Decodable for EnumSet < T > {
147+ fn decode < D : Decoder > ( d : & mut D ) -> Result < EnumSet < T > , D :: Error > {
166148 let bits = try!( d. read_uint ( ) ) ;
167149 let mut set = EnumSet :: new ( ) ;
168150 for bit in range ( 0 , uint:: BITS ) {
@@ -175,14 +157,12 @@ impl<
175157}
176158
177159impl <
178- E ,
179- S : Encoder < E > ,
180- K : Encodable < S , E > + Hash < X > + Eq ,
181- V : Encodable < S , E > ,
160+ K : Encodable + Hash < X > + Eq ,
161+ V : Encodable ,
182162 X ,
183163 H : Hasher < X >
184- > Encodable < S , E > for HashMap < K , V , H > {
185- fn encode ( & self , e : & mut S ) -> Result < ( ) , E > {
164+ > Encodable for HashMap < K , V , H > {
165+ fn encode < S : Encoder > ( & self , e : & mut S ) -> Result < ( ) , S :: Error > {
186166 e. emit_map ( self . len ( ) , |e| {
187167 let mut i = 0 ;
188168 for ( key, val) in self . iter ( ) {
@@ -196,14 +176,12 @@ impl<
196176}
197177
198178impl <
199- E ,
200- D : Decoder < E > ,
201- K : Decodable < D , E > + Hash < S > + Eq ,
202- V : Decodable < D , E > ,
179+ K : Decodable + Hash < S > + Eq ,
180+ V : Decodable ,
203181 S ,
204182 H : Hasher < S > + Default
205- > Decodable < D , E > for HashMap < K , V , H > {
206- fn decode ( d : & mut D ) -> Result < HashMap < K , V , H > , E > {
183+ > Decodable for HashMap < K , V , H > {
184+ fn decode < D : Decoder > ( d : & mut D ) -> Result < HashMap < K , V , H > , D :: Error > {
207185 d. read_map ( |d, len| {
208186 let hasher = Default :: default ( ) ;
209187 let mut map = HashMap :: with_capacity_and_hasher ( len, hasher) ;
@@ -218,13 +196,11 @@ impl<
218196}
219197
220198impl <
221- E ,
222- S : Encoder < E > ,
223- T : Encodable < S , E > + Hash < X > + Eq ,
199+ T : Encodable + Hash < X > + Eq ,
224200 X ,
225201 H : Hasher < X >
226- > Encodable < S , E > for HashSet < T , H > {
227- fn encode ( & self , s : & mut S ) -> Result < ( ) , E > {
202+ > Encodable for HashSet < T , H > {
203+ fn encode < S : Encoder > ( & self , s : & mut S ) -> Result < ( ) , S :: Error > {
228204 s. emit_seq ( self . len ( ) , |s| {
229205 let mut i = 0 ;
230206 for e in self . iter ( ) {
@@ -237,13 +213,11 @@ impl<
237213}
238214
239215impl <
240- E ,
241- D : Decoder < E > ,
242- T : Decodable < D , E > + Hash < S > + Eq ,
216+ T : Decodable + Hash < S > + Eq ,
243217 S ,
244218 H : Hasher < S > + Default
245- > Decodable < D , E > for HashSet < T , H > {
246- fn decode ( d : & mut D ) -> Result < HashSet < T , H > , E > {
219+ > Decodable for HashSet < T , H > {
220+ fn decode < D : Decoder > ( d : & mut D ) -> Result < HashSet < T , H > , D :: Error > {
247221 d. read_seq ( |d, len| {
248222 let mut set = HashSet :: with_capacity_and_hasher ( len, Default :: default ( ) ) ;
249223 for i in range ( 0 u, len) {
@@ -254,12 +228,8 @@ impl<
254228 }
255229}
256230
257- impl <
258- E ,
259- S : Encoder < E > ,
260- V : Encodable < S , E >
261- > Encodable < S , E > for VecMap < V > {
262- fn encode ( & self , e : & mut S ) -> Result < ( ) , E > {
231+ impl < V : Encodable > Encodable for VecMap < V > {
232+ fn encode < S : Encoder > ( & self , e : & mut S ) -> Result < ( ) , S :: Error > {
263233 e. emit_map ( self . len ( ) , |e| {
264234 for ( i, ( key, val) ) in self . iter ( ) . enumerate ( ) {
265235 try!( e. emit_map_elt_key ( i, |e| key. encode ( e) ) ) ;
@@ -270,12 +240,8 @@ impl<
270240 }
271241}
272242
273- impl <
274- E ,
275- D : Decoder < E > ,
276- V : Decodable < D , E >
277- > Decodable < D , E > for VecMap < V > {
278- fn decode ( d : & mut D ) -> Result < VecMap < V > , E > {
243+ impl < V : Decodable > Decodable for VecMap < V > {
244+ fn decode < D : Decoder > ( d : & mut D ) -> Result < VecMap < V > , D :: Error > {
279245 d. read_map ( |d, len| {
280246 let mut map = VecMap :: new ( ) ;
281247 for i in range ( 0 u, len) {
0 commit comments