diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2014-05-05 18:56:44 -0700 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2014-05-06 23:12:54 -0700 |
| commit | 090040bf4037a094e50b03d79e4baf5cd89c912b (patch) | |
| tree | 27fa91d623889d59260d3db167abdfa8c4288849 /src/libstd/io/util.rs | |
| parent | 24f6f26e633e50b5b59f9d0f6cca0b1e49e215d9 (diff) | |
| download | rust-090040bf4037a094e50b03d79e4baf5cd89c912b.tar.gz rust-090040bf4037a094e50b03d79e4baf5cd89c912b.zip | |
librustc: Remove `~EXPR`, `~TYPE`, and `~PAT` from the language, except
for `~str`/`~[]`. Note that `~self` still remains, since I forgot to add support for `Box<self>` before the snapshot. How to update your code: * Instead of `~EXPR`, you should write `box EXPR`. * Instead of `~TYPE`, you should write `Box<Type>`. * Instead of `~PATTERN`, you should write `box PATTERN`. [breaking-change]
Diffstat (limited to 'src/libstd/io/util.rs')
| -rw-r--r-- | src/libstd/io/util.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/libstd/io/util.rs b/src/libstd/io/util.rs index 5cae79d371f..b2e6b27caab 100644 --- a/src/libstd/io/util.rs +++ b/src/libstd/io/util.rs @@ -13,6 +13,7 @@ use prelude::*; use cmp; use io; +use owned::Box; use slice::bytes::MutableByteVector; /// Wraps a `Reader`, limiting the number of bytes that can be read from it. @@ -85,12 +86,12 @@ impl Reader for NullReader { /// A `Writer` which multiplexes writes to a set of `Writers`. pub struct MultiWriter { - writers: Vec<~Writer> + writers: Vec<Box<Writer>> } impl MultiWriter { /// Creates a new `MultiWriter` - pub fn new(writers: Vec<~Writer>) -> MultiWriter { + pub fn new(writers: Vec<Box<Writer>>) -> MultiWriter { MultiWriter { writers: writers } } } @@ -199,6 +200,7 @@ pub fn copy<R: Reader, W: Writer>(r: &mut R, w: &mut W) -> io::IoResult<()> { mod test { use io; use io::{MemReader, MemWriter}; + use owned::Box; use super::*; use prelude::*; @@ -273,8 +275,8 @@ mod test { } } - let mut multi = MultiWriter::new(vec!(box TestWriter as ~Writer, - box TestWriter as ~Writer)); + let mut multi = MultiWriter::new(vec!(box TestWriter as Box<Writer>, + box TestWriter as Box<Writer>)); multi.write([1, 2, 3]).unwrap(); assert_eq!(2, unsafe { writes }); assert_eq!(0, unsafe { flushes }); |
