Skip to content

Latest commit

 

History

History
15 lines (12 loc) · 371 Bytes

strings.md

File metadata and controls

15 lines (12 loc) · 371 Bytes

Strings

Rust has two string types, a string slice (&str) and an owned string (String).

Creating a New String

// Creates an empty String to load data into
let mut s = String::new();

// Create String using the Display trait method to_string()
let word = "word";
let w = word.to_string();

// Create String using from
let f = String::from("howdy");