3 ms·
I mean, pressing the button to collapse the documentation isn't very hard http://i.imgur.com/rcI3JG5.jpg http://i.imgur.com/rcI3JG5.jpg I never had to print an
by Tarean 10y ago
I mean, pressing the button to collapse the documentation isn't very hard http://i.imgur.com/rcI3JG5.jpg http://i.imgur.com/rcI3JG5.jpg
I never had to print an osstr yet but it seems fairly straightforward when looking at the docs? There are three obvious functions one could use, each for different use cases: https://doc.rust-lang.org/std/ffi/struct.OsString.html https://doc.rust-lang.org/std/ffi/struct.OsString.html
os_string.to_str() // returns Option<String>
os_string.to_string_lossy() // returns Cow<String>, replacing illegal characters
os_string.into_string() // returns Result<String, OsString> - String if the data is valid, stays OsString for error handling otherwise