diff options
| author | Daniel Micay <danielmicay@gmail.com> | 2014-11-11 16:01:29 -0500 |
|---|---|---|
| committer | Daniel Micay <danielmicay@gmail.com> | 2014-11-18 01:09:46 -0500 |
| commit | 85c2c2e38ce7c606fac1e9c8fa9d2ab71b35c8c8 (patch) | |
| tree | 578802f9e774e104b1a271b92946208e0e0a0675 /src/test/run-pass/auto-encode.rs | |
| parent | 9c96a79a74f10bed18b031ce0ac4126c56d6cfb3 (diff) | |
| download | rust-85c2c2e38ce7c606fac1e9c8fa9d2ab71b35c8c8.tar.gz rust-85c2c2e38ce7c606fac1e9c8fa9d2ab71b35c8c8.zip | |
implement Writer for Vec<u8>
The trait has an obvious, sensible implementation directly on vectors so the MemWriter wrapper is unnecessary. This will halt the trend towards providing all of the vector methods on MemWriter along with eliminating the noise caused by conversions between the two types. It also provides the useful default Writer methods on Vec<u8>. After the type is removed and code has been migrated, it would make sense to add a new implementation of MemWriter with seeking support. The simple use cases can be covered with vectors alone, and ones with the need for seeks can use a new MemWriter implementation.
Diffstat (limited to 'src/test/run-pass/auto-encode.rs')
| -rw-r--r-- | src/test/run-pass/auto-encode.rs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/test/run-pass/auto-encode.rs b/src/test/run-pass/auto-encode.rs index 44006a0039a..3fc2ed5468a 100644 --- a/src/test/run-pass/auto-encode.rs +++ b/src/test/run-pass/auto-encode.rs @@ -31,12 +31,11 @@ fn test_rbml<'a, 'b, A: Encodable<EBWriter::Encoder<'a>> + Decodable<EBReader::Decoder<'b>> >(a1: &A) { - let mut wr = std::io::MemWriter::new(); + let mut wr = Vec::new(); let mut rbml_w = EBwriter::Encoder::new(&mut wr); a1.encode(&mut rbml_w); - let bytes = wr.get_ref(); - let d: serialize::rbml::Doc<'a> = EBDoc::new(bytes); + let d: serialize::rbml::Doc<'a> = EBDoc::new(wr[]); let mut decoder: EBReader::Decoder<'a> = EBreader::Decoder::new(d); let a2: A = Decodable::decode(&mut decoder); assert!(*a1 == a2); |
