Option
If you want null-able Values, Option
is very suitable.
For any type T
, Option<T>
is valid type and it is null-able.
Null Value can be denoted as None
.
let name: Option<String> = None;
In other hand, not null Values for null-able are denoted with Some(_)
.
let name: Option<String> = Some("MGR");
Some
is considered as a natural transformation T -> Option<T>
representing not null Values.