use inline_option::{IOption, Nullable};
#[derive(Clone, Copy, Debug, PartialEq)]
struct Value(i32);
impl Nullable for Value {
const NULL: Self = Value(i32::MAX);
fn is_null(&self) -> bool {
self.0 == i32::MAX
}
}
fn main() {
let mut opt = IOption::<Value>::none();
assert!(opt.is_none());
opt.replace(Value(42));
assert!(opt.is_some());
let value = opt.unwrap();
assert_eq!(value.0, 42);
let std_opt = opt.as_ref();
assert_eq!(std_opt, Some(&Value(42)));
}