3 ms·
That looks similar to Rust's enums. The compiler enforces exhaustiveness in pattern matching. enum WebEvent { // An `enum` may either be `unit-like`,
by MrBuddyCasino 9y ago
That looks similar to Rust's enums. The compiler enforces exhaustiveness in pattern matching.
enum WebEvent {
// An `enum` may either be `unit-like`,
PageLoad,
PageUnload,
// like tuple structs,
KeyPress(char),
Paste(String),
// or like structures.
Click { x: i64, y: i64 },
}
- willtim 9y agoOCaml was a big influence on the design of Rust.