Skip to content

Commit

Permalink
editoast: make 'Result' more flexible
Browse files Browse the repository at this point in the history
When defining a new `Result`, it's sometimes annoying having a
`Result` available and trying to use it as `Result<T, E>` but actually,
there is only one generic argument.

Replacing `type Result<T> = StdResult<T, InternalError>` by
`type Result<T, E = InternalError> = StdResult<T, E>` keep the
bonus of using a custom `Result` (always returning our `InternalError`)
but leaving the possibility to opt-out easily by specifying the second
generic argument.
  • Loading branch information
woshilapin committed Apr 3, 2024
1 parent d5573a1 commit 7385265
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion editoast/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ crate::schemas! {
InternalError,
}

pub type Result<T> = StdResult<T, InternalError>;
pub type Result<T, E = InternalError> = StdResult<T, E>;

/// Trait for all errors that can be returned by editoast
pub trait EditoastError: Error + Send + Sync {
Expand Down

0 comments on commit 7385265

Please sign in to comment.