Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement Writer for Vec<u8> #18885

Merged
merged 1 commit into from
Nov 18, 2014
Merged

implement Writer for Vec<u8> #18885

merged 1 commit into from
Nov 18, 2014

Conversation

thestinger
Copy link
Contributor

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.

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.

@erickt
Copy link
Contributor

erickt commented Nov 11, 2014

Looks good to me, but I'll defer to someone else to r+ since this is deprecating a commonly used library.

@reem
Copy link
Contributor

reem commented Nov 11, 2014

This is awesome, especially because it allows us to put new features on MemWriter in the future.

@Gankra
Copy link
Contributor

Gankra commented Nov 11, 2014

r? @aturon

@sfackler
Copy link
Member

We do have a seekable MemWriter hidden away in librbml that we could move over: http://doc.rust-lang.org/rbml/io/struct.SeekableMemWriter.html

@sfackler
Copy link
Member

Looks like it needs a rebase

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.
bors added a commit that referenced this pull request Nov 18, 2014
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.
@bors bors closed this Nov 18, 2014
@bors bors merged commit 85c2c2e into rust-lang:master Nov 18, 2014
bors added a commit that referenced this pull request Dec 4, 2014
This continues the work @thestinger started in #18885 (which hasn't landed yet, so wait for that to land before landing this one). Instead of adding more methods to `BufReader`, this just allows a `&[u8]` to be used directly as a `Reader`. It also adds an impl of `Writer` for `&mut [u8]`.
@thestinger thestinger deleted the writer branch January 28, 2015 03:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants