inline result utils
This commit is contained in:
parent
fa601cb023
commit
70c48ea9ab
1 changed files with 3 additions and 1 deletions
|
@ -1,5 +1,6 @@
|
|||
use std::fmt::Debug;
|
||||
|
||||
#[inline]
|
||||
pub fn result_override<T, E: Debug>(r: Result<T, E>, msg: String) -> Result<T, String> {
|
||||
return match r {
|
||||
Ok(t) => Ok(t),
|
||||
|
@ -7,7 +8,8 @@ pub fn result_override<T, E: Debug>(r: Result<T, E>, msg: String) -> Result<T, S
|
|||
};
|
||||
}
|
||||
|
||||
pub fn result_prefix<T: Debug, E: Debug>(r: Result<T, E>, prefix: String) -> Result<T, String> {
|
||||
#[inline]
|
||||
pub fn result_prefix<T, E: Debug>(r: Result<T, E>, prefix: String) -> Result<T, String> {
|
||||
return match r {
|
||||
Ok(t) => Ok(t),
|
||||
Err(e) => Err(format!("{}: {:?}", prefix, e))
|
||||
|
|
Reference in a new issue