5 releases
Uses old Rust 2015
0.1.4 | Aug 10, 2017 |
---|---|
0.1.3 | Aug 9, 2017 |
0.1.2 | Aug 4, 2017 |
0.1.1 | Aug 4, 2017 |
0.1.0 | Aug 3, 2017 |
#10 in #growable
24KB
376 lines
str
lib.rs
:
A UTF-8 encoded, growable string.
The Str
type is string type that has owership over the [char].
Example
You can create a Str
from a literal string with Str::from
:
use str::Str;
let hello = Str::from("hello, world!");
You can append a char
to a Str
with the push
method, and
append a &str
with the push_str
method;
use str::Str;
let mut hello = Str::from("Hello, ");
hello.push('w');
hello.push_str("orld!");
If you have a String
, you can create a Str
from it with the
from
method, and you can convert Str
to String
whit the
into
method:
use str::Str;
let hello = String::from("Hello world!");
let world = Str::from(hello);
let hello_world: String = world.into();