Skip to content

Add MemWriter::from_vec #18329

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

Merged
merged 1 commit into from
Oct 28, 2014
Merged

Add MemWriter::from_vec #18329

merged 1 commit into from
Oct 28, 2014

Conversation

sfackler
Copy link
Member

This is useful in cases where you're buffering and sending data in a loop, like this: https://github.com/sfackler/rust-postgres/blob/a480ec1cfb94a155dad64cfad821e4c7d1b8dccb/src/lib.rs#L1628-L1674

@sfackler
Copy link
Member Author

An alternative API would be to add a fn from_vec(v: Vec<u8>) -> MemWriter constructor. I don't really have strong feelings either way.

@sfackler
Copy link
Member Author

On second thought, I think the from_vec approach offers some more flexibility so I switched to that.

@sfackler sfackler changed the title Add MemWriter::clear Add MemWriter::from_vec Oct 26, 2014
alexcrichton added a commit to alexcrichton/rust that referenced this pull request Oct 27, 2014
@bors bors merged commit bed5a7d into rust-lang:master Oct 28, 2014
@sfackler sfackler deleted the memwriter-clear branch November 26, 2016 05:54
@sfackler sfackler restored the memwriter-clear branch November 26, 2016 05:54
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.

3 participants