Rust basics: Option and Result
·480 words·3 mins
Rust does not use null for ordinary absence, and it does not rely on exceptions for recoverable errors. Instead, it uses enums: Option<T> and Result<T, E>. These two types show up everywhere. Once they are clear, a lot of Rust APIs read more plainly.