Add constructor ArrayString::from_byte_string(b"abc")
This is an alternative constructor that never has capacity errors. Unfortunately the error case is invalid UTF-8!
This commit is contained in:
@@ -346,6 +346,14 @@ fn test_string_from() {
|
||||
assert_eq!(u.len(), text.len());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_string_from_bytes() {
|
||||
let text = "hello world";
|
||||
let u = ArrayString::from_byte_string(b"hello world").unwrap();
|
||||
assert_eq!(&u, text);
|
||||
assert_eq!(u.len(), text.len());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_string_clone() {
|
||||
let text = "hi";
|
||||
|
||||
Reference in New Issue
Block a user