Created
November 4, 2021 15:35
-
-
Save harryscholes/144a2a19d37740f509fe8620791166cc to your computer and use it in GitHub Desktop.
Rust custom Option type
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum MyOption<T> { | |
MySome(T), | |
MyNone, | |
} | |
use MyOption::{MyNone, MySome}; | |
fn main() { | |
let mut x = MySome(1i32); | |
x = MyNone; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment