src/main.rs:
struct FooError;
struct OneError;
struct TwoError;
impl From<OneError> for FooError {
fn from(_: OneError) -> Self {
FooError
}
}
impl From<TwoError> for FooError {
fn from(_: TwoError) -> Self {
FooError
}
}
fn my_test_fn() -> Result<(), FooError> {
let one: Result<(), OneError> = Err(OneError);
one?;
let two: Result<(), TwoError> = Err(TwoError);
two?;
Ok(())
}
fn main() {
let result = my_test_fn();
println!("error? {}", result.is_err());
}