diff --git a/src/doc/tutorial.md b/src/doc/tutorial.md index 10f67876e508f..325eb9f0a2a5b 100644 --- a/src/doc/tutorial.md +++ b/src/doc/tutorial.md @@ -2079,21 +2079,23 @@ struct Stack { elements: Vec } -enum Option { - Some(T), - None +enum Maybe { + Just(T), + Nothing } # fn main() {} ~~~~ These declarations can be instantiated to valid types like `Set`, -`Stack`, and `Option`. - -The last type in that example, `Option`, appears frequently in Rust code. -Because Rust does not have null pointers (except in unsafe code), we need -another way to write a function whose result isn't defined on every possible -combination of arguments of the appropriate types. The usual way is to write -a function that returns `Option` instead of `T`. +`Stack`, and `Maybe`. + +The last type in that example, `Maybe`, is already defined in Rust as +the type `Option` with the variants `Some(T)` and `None`. +`Option` appears frequently in Rust code. +Because Rust does not have null pointers (except in unsafe code), +we need another way to write a function whose result isn't defined on every +possible combination of arguments of the appropriate types. The usual way is to +write a function that returns `Option` instead of `T`. ~~~~ # struct Point { x: f64, y: f64 }