std-type
OsString: owned native string
Store and concatenate owned native strings; conversion to String is fallible. Use PathBuf instead when composing paths. Expected stdout (not executed): report.csv Common mistake: Using string concatenation to join path components.
Formal Syntax & Structure
rust syntaxrust
OsString::from(s); name.push(s); name.into_string() -> Result<String, OsString>Working Example
Example Snippetrust
fn main() { use std::ffi::OsString; let mut name = OsString::from("report"); name.push(".csv"); println!("{}", name.into_string().unwrap());}