We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 9bf62f7 + be6ae6e commit dfe46f7Copy full SHA for dfe46f7
src/libstd/io/mem.rs
@@ -27,8 +27,14 @@ pub struct MemWriter {
27
}
28
29
impl MemWriter {
30
+ /// Create a new `MemWriter`.
31
pub fn new() -> MemWriter {
- MemWriter { buf: vec::with_capacity(128), pos: 0 }
32
+ MemWriter::with_capacity(128)
33
+ }
34
+ /// Create a new `MemWriter`, allocating at least `n` bytes for
35
+ /// the internal buffer.
36
+ pub fn with_capacity(n: uint) -> MemWriter {
37
+ MemWriter { buf: vec::with_capacity(n), pos: 0 }
38
39
40
0 commit comments