File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ use slice;
22
22
use slice:: AsSlice ;
23
23
use vec:: Vec ;
24
24
25
- static BUF_CAPACITY : uint = 128 ;
25
+ const BUF_CAPACITY : uint = 128 ;
26
26
27
27
fn combine ( seek : SeekStyle , cur : uint , end : uint , offset : i64 ) -> IoResult < u64 > {
28
28
// compute offset as signed and clamp to prevent overflow
@@ -71,7 +71,12 @@ impl MemWriter {
71
71
/// the internal buffer.
72
72
#[ inline]
73
73
pub fn with_capacity ( n : uint ) -> MemWriter {
74
- MemWriter { buf : Vec :: with_capacity ( n) }
74
+ MemWriter :: from_vec ( Vec :: with_capacity ( n) )
75
+ }
76
+ /// Create a new `MemWriter` that will append to an existing `Vec`.
77
+ #[ inline]
78
+ pub fn from_vec ( buf : Vec < u8 > ) -> MemWriter {
79
+ MemWriter { buf : buf }
75
80
}
76
81
77
82
/// Acquires an immutable reference to the underlying buffer of this
You can’t perform that action at this time.
0 commit comments