使用旧的 Rust 2015
0.1.1 |
|
---|---|
0.1.0 |
|
#14 in #instantiation
4KB
80 行
StringBuf
为 Rust 语言提供的一个简洁且优秀的字符串连接库。
准备
将以下内容放入您的 Cargo.toml
[dependencies]
stringbuf = "0.1.0"
用法
实例化
extern crate stringbuf;
use stringbuf::StringBuf;
fn main() {
let mut sb = StringBuf::from("Hello");
sb = sb + " " + "world!";
sb += " AddAssign works,";
assert_eq!("Hello world! AddAssign works, as does appending by method.",
*sb.append(" as does appending by method."));
}