Option<T>
type is Rust's equivalent of nullable types, without all the issues that come with it. The majority of C-like languages allow any variable to be null
if there is no data present, but the Option
type is inspired by functional languages which favour 'optionals' (e.g. Haskell's Maybe
monad). Using Option
types will allow you to express the idea that data may or may not be there (since Rust doesn't have nullable types).