//! The optional type, representing the presence or absence of a thing. use super::preamble::*; pub enum Option { Some(T), None, } impl Option { pub fn is_some(self: &Self) -> bool { match self { Some(_) => true, None => false, } } pub fn is_none(self: &Self) -> bool { match self { Some(_) => false, None => true, } } /// Maps from one option space to another // pub fn map(self: Self, f: fn(T) -> U) -> Option { // match self { // Some(value) => Some(f(value)), // None => None, // } // } }