提交 bdc1b7a8 编写于 作者: E Erick Tryzelaar

libcore: add a str::with_capacity to match the fn in vec

上级 22efa393
......@@ -1473,6 +1473,11 @@ fn is_alphanumeric(s: &str) -> bool {
move buf
}
pub pure fn with_capacity(capacity: uint) -> ~str {
let mut buf = ~"";
unsafe { reserve(&mut buf, capacity); }
move buf
}
/**
* As char_len but for a slice of a string
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册