rustlings

solving rustlings ft. dracuxan
git clone [email protected]:dracuxan/rustlings.git
Log | Files | Refs

README.md (1012B)


      1 # Options
      2 
      3 Type Option represents an optional value: every Option is either Some and contains a value, or None, and does not.
      4 Option types are very common in Rust code, as they have a number of uses:
      5 
      6 - Initial values
      7 - Return values for functions that are not defined over their entire input range (partial functions)
      8 - Return value for otherwise reporting simple errors, where None is returned on error
      9 - Optional struct fields
     10 - Struct fields that can be loaned or "taken"
     11 - Optional function arguments
     12 - Nullable pointers
     13 - Swapping things out of difficult situations
     14 
     15 ## Further Information
     16 
     17 - [Option Enum Format](https://doc.rust-lang.org/book/ch10-01-syntax.html#in-enum-definitions)
     18 - [Option Module Documentation](https://doc.rust-lang.org/std/option/)
     19 - [Option Enum Documentation](https://doc.rust-lang.org/std/option/enum.Option.html)
     20 - [if let](https://doc.rust-lang.org/rust-by-example/flow_control/if_let.html)
     21 - [while let](https://doc.rust-lang.org/rust-by-example/flow_control/while_let.html)