1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
#![cfg_attr(not(feature = "std"), no_std)] #[cfg(all(feature = "command", not(feature = "std")))] compile_error!("`command` feature requires `std`"); #[cfg(all(feature = "command", feature = "std"))] pub mod command; use core::{option::Option, result::Result}; pub trait IntoResult<T, E> { fn into_result(self) -> Result<T, E>; fn into_option(self) -> Option<T> where Self: Sized, { self.into_result().ok() } } impl IntoResult<(), ()> for bool { fn into_result(self) -> Result<(), ()> { if self { Ok(()) } else { Err(()) } } }