jffaufwwasd·letztes Jahr·discussThis is where you should be combining them.Ok' and Err' as nominal type constructors which are unioned: struct Ok<T>(T); struct Err<E>(E); fn parse_error(input_string: &str) -> Ok Error | Err (ErrorA | ErrorB | ErrorC...) Or make a sum type enum Result<T, E> { Ok(T), Err(E), } fn parse_error(input_string: &str) -> Result<Error, (ErrorA | ErrorB | ErrorC...)> The error types are unioned for easy composition but you have a top level sum type to differentiate between success and failure.
Ok' and Err' as nominal type constructors which are unioned:
Or make a sum type
The error types are unioned for easy composition but you have a top level sum type to differentiate between success and failure.