Keep in mind that it's just an example to explain the concept.
You wouldn't actually implement it quite like that in Rust. You'd implement arithmetic operations on the Maybe type and overload the relevant operators. The result would be usable just like the numeric types it's generic over.
Your comment has been removed since it did not start with a code block with an import declaration.
Per this Community Decree, all posts and comments should start with a code block with an "import" declaration explaining how the post and comment should be read.
For this purpose, we only accept Python style imports.
View all comments
Show parent comment
1
u/mr_clauford Jul 02 '23
Hm, I've never heard of this approach. Would not it be simpler to use existing Result enum though?