errcast

Macro errcast 

Source
macro_rules! errcast {
    ($result:expr) => { ... };
    ($result:expr, $format_str:literal$(, $val:expr )*) => { ... };
    ($result:expr, $kind:ty$(, $format_str:expr$(, $val:expr )* )?) => { ... };
}
Expand description

Any type of error can be converted into our Master Error. (non panic unwraping)

// example
// <Unwraped Ok> = errcast!(<Any Result>, <Master Err>, <Optional,..>);
let num_read = errcast!(file.read(&mut buf), err::ReadErr, "this is {} data.", "meta");

also can

let num_read = errcast!(file.read(&mut buf));
let num_read = errcast!(file.read(&mut buf), "some error.");