Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@harryscholes
Created November 4, 2021 15:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save harryscholes/144a2a19d37740f509fe8620791166cc to your computer and use it in GitHub Desktop.
Save harryscholes/144a2a19d37740f509fe8620791166cc to your computer and use it in GitHub Desktop.
Rust custom Option type
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