Strings In Depth5 / 18
Up next

Ways to make a String

fn main() {
    // four common ways to get an owned String from a &str
    let a: String = "x".to_string();
    let b: String = "y".to_owned();
    let c: String = String::from("z");
    let d: String = "w".into();
    println!("{a}{b}{c}{d}");
}
What you're solving

to_string, to_owned, from, into