macro_rules! from_infallible {
($ty:ty) => { ... };
}Expand description
Utility macro for easily defining From<Infallible> for a given type.
ยงExample
use core::convert::Infallible;
use strid::from_infallible;
pub struct MyType;
from_infallible!(MyType);
let result: Result<(), Infallible> = Ok(());
let my_result: Result<(), MyType> = result.map_err(MyType::from);