Mastodon Feed: Post

Mastodon Feed

rust@octodon.social ("Rust tips") wrote:

You never need more than one .and_then(…) or .map(…).flatten(),
because the ? operator works inside the closure.

maybe_object    .and_then(|o| o.path.file_name())    .and_then(|p| p.to_str())    .and_then(|s| {        delim.and_then(|d| s.split_once(d))    })maybe_object.and_then(|o| {    o.path.file_name()?.to_str()?.split_once(delim?)})

#Rustlang