Expand description
The one and only string type in Rust
let foo: &str = "foo".into();
let expected: &str = "foobar".into();
let mut foobar = foo.to_owned();
foobar.push_str("bar".into());
assert_eq!(foobar, *expected);
Structs§
Functions§
- from_
utf8 - Converts a slice of bytes to a string slice.
- from_
utf8_ mut - Converts a mutable slice of bytes to a mutable string slice.
- from_
utf8_ ⚠unchecked - Converts a slice of bytes to a string slice without checking that the string contains valid UTF-8.
- from_
utf8_ ⚠unchecked_ mut - Converts a slice of bytes to a string slice without checking that the string contains valid UTF-8.
Type Aliases§
- Array
String - Same API as
String
but without any re-allocation. Can only hold up toN
bytes - Array
String32 - UTF-32 Owned String that has a fixed capacity
- Owned
String - String
- Exactly the same as
std::string::String
, except generic - String32
- UTF-32 Owned String that supports reallocation
- String
Slice - str
- Exactly the same as
std::primitive::str
, except generic - str32
- Exactly the same as
std::str
, except generic