[Rust]get file name

nk_maker

ke na

Posted on July 22, 2024

[Rust]get file name

Mypath.file_name().unwrap().to_string_lossy().into_owned();

Mypath:type of object 
file_name():method of retreaving tail of path and return Option<&OsStr>
unwrap(): method of retreaving Option type
to_string_lossy():method of changing to string(lossy is just like forced)
.into_owned():method of changing to string have Cow

💖 💪 🙅 🚩
nk_maker
ke na

Posted on July 22, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

December Surely Looks Busy!
opensource December Surely Looks Busy!

November 29, 2024

December Surely Looks Busy!
opensource December Surely Looks Busy!

November 29, 2024

Daemons on macOS with Rust
undefined Daemons on macOS with Rust

November 29, 2024