@@ -120,7 +120,7 @@ impl<R> fmt::Debug for BufReader<R> where R: fmt::Debug {
120
120
///
121
121
/// The buffer will be written out when the writer is dropped.
122
122
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
123
- pub struct BufWriter < W > {
123
+ pub struct BufWriter < W : Write > {
124
124
inner : Option < W > ,
125
125
buf : Vec < u8 > ,
126
126
}
@@ -220,7 +220,7 @@ impl<W: Write> Write for BufWriter<W> {
220
220
}
221
221
222
222
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
223
- impl < W > fmt:: Debug for BufWriter < W > where W : fmt:: Debug {
223
+ impl < W : Write > fmt:: Debug for BufWriter < W > where W : fmt:: Debug {
224
224
fn fmt ( & self , fmt : & mut fmt:: Formatter ) -> fmt:: Result {
225
225
write ! ( fmt, "BufWriter {{ writer: {:?}, buffer: {}/{} }}" ,
226
226
self . inner. as_ref( ) . unwrap( ) , self . buf. len( ) , self . buf. capacity( ) )
@@ -276,7 +276,7 @@ impl<W> fmt::Display for IntoInnerError<W> {
276
276
///
277
277
/// The buffer will be written out when the writer is dropped.
278
278
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
279
- pub struct LineWriter < W > {
279
+ pub struct LineWriter < W : Write > {
280
280
inner : BufWriter < W > ,
281
281
}
282
282
@@ -335,24 +335,24 @@ impl<W: Write> Write for LineWriter<W> {
335
335
}
336
336
337
337
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
338
- impl < W > fmt:: Debug for LineWriter < W > where W : fmt:: Debug {
338
+ impl < W : Write > fmt:: Debug for LineWriter < W > where W : fmt:: Debug {
339
339
fn fmt ( & self , fmt : & mut fmt:: Formatter ) -> fmt:: Result {
340
340
write ! ( fmt, "LineWriter {{ writer: {:?}, buffer: {}/{} }}" ,
341
341
self . inner. inner, self . inner. buf. len( ) ,
342
342
self . inner. buf. capacity( ) )
343
343
}
344
344
}
345
345
346
- struct InternalBufWriter < W > ( BufWriter < W > ) ;
346
+ struct InternalBufWriter < W : Write > ( BufWriter < W > ) ;
347
347
348
- impl < W > InternalBufWriter < W > {
348
+ impl < W : Read + Write > InternalBufWriter < W > {
349
349
fn get_mut ( & mut self ) -> & mut BufWriter < W > {
350
350
let InternalBufWriter ( ref mut w) = * self ;
351
351
return w;
352
352
}
353
353
}
354
354
355
- impl < W : Read > Read for InternalBufWriter < W > {
355
+ impl < W : Read + Write > Read for InternalBufWriter < W > {
356
356
fn read ( & mut self , buf : & mut [ u8 ] ) -> io:: Result < usize > {
357
357
self . get_mut ( ) . inner . as_mut ( ) . unwrap ( ) . read ( buf)
358
358
}
@@ -367,7 +367,7 @@ impl<W: Read> Read for InternalBufWriter<W> {
367
367
///
368
368
/// The output buffer will be written out when this stream is dropped.
369
369
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
370
- pub struct BufStream < S > {
370
+ pub struct BufStream < S : Write > {
371
371
inner : BufReader < InternalBufWriter < S > >
372
372
}
373
373
@@ -448,7 +448,7 @@ impl<S: Read + Write> Write for BufStream<S> {
448
448
}
449
449
450
450
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
451
- impl < S > fmt:: Debug for BufStream < S > where S : fmt:: Debug {
451
+ impl < S : Write > fmt:: Debug for BufStream < S > where S : fmt:: Debug {
452
452
fn fmt ( & self , fmt : & mut fmt:: Formatter ) -> fmt:: Result {
453
453
let reader = & self . inner ;
454
454
let writer = & self . inner . inner . 0 ;
0 commit comments