Say we want to implement the following function:
fn add(x: Option<int>, y: Option<int>) -> Option<int> { ... }
Some functional languages, like Haskell and Scala offer some sort of a "do"
notation to make unwrapping multiple Option type values easier.
add :: Maybe Int -> Maybe Int -> Maybe Int
add mx my = do
x <- mx
y <- my
return (x + y)
Is there an equivalent construct in Rust?
--
Ziad
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev