4个稳定版本
1.1.1 | 2023年1月13日 |
---|---|
1.1.0 | 2022年10月25日 |
1.0.1 | 2022年10月21日 |
#1402 在 文本处理
40 每月下载次数
用于 2 crate
10KB
183 行
StringBox
允许开发者从字节字符串、UTF-8编码的C字符串或宽字符串创建Rust String
。
示例
从非空终止的字节字符串
let byte_string = vec![104u8, 101, 108, 108, 111];
let string = StringBox::from_byte_string(byte_string);
assert_eq!(string.to_string(), String::from("hello"));
从空终止的UTF-8字符串
let utf8_string = vec![104u8, 101, 108, 108, 111, 0];
let string = StringBox::from_utf8_string(utf8_string.as_slice());
assert_eq!(string.to_string(), String::from("hello"));
依赖关系
~520KB