diff options
Diffstat (limited to 'src/libcore/io.rs')
| -rw-r--r-- | src/libcore/io.rs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/libcore/io.rs b/src/libcore/io.rs index 571d9344243..2173efe5ac6 100644 --- a/src/libcore/io.rs +++ b/src/libcore/io.rs @@ -169,7 +169,7 @@ pub trait ReaderUtil { fn read_i8(&self) -> i8; } -impl<T: Reader> T : ReaderUtil { +impl<T: Reader> ReaderUtil for T { fn read_bytes(&self,len: uint) -> ~[u8] { let mut bytes = vec::with_capacity(len); @@ -415,7 +415,7 @@ fn convert_whence(whence: SeekStyle) -> i32 { }; } -impl *libc::FILE: Reader { +impl Reader for *libc::FILE { fn read(&self, bytes: &mut [u8], len: uint) -> uint { unsafe { do vec::as_mut_buf(bytes) |buf_p, buf_len| { @@ -460,7 +460,7 @@ struct Wrapper<T, C> { // A forwarding impl of reader that also holds on to a resource for the // duration of its lifetime. // FIXME there really should be a better way to do this // #2004 -impl<R: Reader, C> Wrapper<R, C>: Reader { +impl<R: Reader, C> Reader for Wrapper<R, C> { fn read(&self, bytes: &mut [u8], len: uint) -> uint { self.base.read(bytes, len) } @@ -527,7 +527,7 @@ pub struct BytesReader { mut pos: uint } -impl BytesReader: Reader { +impl Reader for BytesReader { fn read(&self, bytes: &mut [u8], len: uint) -> uint { let count = uint::min(len, self.bytes.len() - self.pos); @@ -589,7 +589,7 @@ pub trait Writer { fn get_type(&self) -> WriterType; } -impl<W: Writer, C> Wrapper<W, C>: Writer { +impl<W: Writer, C> Writer for Wrapper<W, C> { fn write(&self, bs: &[const u8]) { self.base.write(bs); } fn seek(&self, off: int, style: SeekStyle) { self.base.seek(off, style); } fn tell(&self) -> uint { self.base.tell() } @@ -597,7 +597,7 @@ impl<W: Writer, C> Wrapper<W, C>: Writer { fn get_type(&self) -> WriterType { File } } -impl *libc::FILE: Writer { +impl Writer for *libc::FILE { fn write(&self, v: &[const u8]) { unsafe { do vec::as_const_buf(v) |vbuf, len| { @@ -647,7 +647,7 @@ pub fn FILE_writer(f: *libc::FILE, cleanup: bool) -> Writer { } } -impl fd_t: Writer { +impl Writer for fd_t { fn write(&self, v: &[const u8]) { unsafe { let mut count = 0u; @@ -890,7 +890,7 @@ pub trait WriterUtil { fn write_i8(&self, n: i8); } -impl<T: Writer> T : WriterUtil { +impl<T: Writer> WriterUtil for T { fn write_char(&self, ch: char) { if ch as uint < 128u { self.write(&[ch as u8]); @@ -996,7 +996,7 @@ pub struct BytesWriter { mut pos: uint, } -impl BytesWriter: Writer { +impl Writer for BytesWriter { fn write(&self, v: &[const u8]) { do self.bytes.swap |bytes| { let mut bytes = move bytes; @@ -1112,7 +1112,7 @@ pub mod fsync { arg: Arg<t>, } - impl<T: Copy> Res<T>: Drop { + impl<T: Copy> Drop for Res<T> { fn finalize(&self) { match self.arg.opt_level { None => (), |
