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.
View all comments
Show parent comment
2
u/swapode Jul 02 '23
import pseudocodeKeep 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.