Crates.io | string |
lib.rs | string |
version | 0.3.1 |
source | src |
created_at | 2017-07-25 19:44:21.614062 |
updated_at | 2024-09-13 16:14:11.884955 |
description | A UTF-8 encoded string with configurable byte storage. |
homepage | https://github.com/carllerche/string |
repository | https://github.com/carllerche/string |
max_upload_size | |
id | 25058 |
size | 14,339 |
A UTF-8 encoded string with configurable byte storage.
To use string
, first add this to your Cargo.toml
:
[dependencies]
string = "0.3.1"
Next, add this to your crate:
extern crate string;
use string::{String, TryFrom};
let s: String<[u8; 2]> = String::try_from([b'h', b'i']).unwrap();
assert_eq!(&s[..], "hi");
See documentation for more details.