1 use cocoa::base::{id, nil}; 2 3 pub trait IntoOption: Sized { into_option(self) -> Option<Self>4 fn into_option(self) -> Option<Self>; 5 } 6 7 impl IntoOption for id { into_option(self) -> Option<Self>8 fn into_option(self) -> Option<Self> { 9 match self != nil { 10 true => Some(self), 11 false => None, 12 } 13 } 14 } 15