feat: almost done with rework communication with remotes now works
This commit is contained in:
parent
fa37331780
commit
a7c36c39ef
14 changed files with 696 additions and 155 deletions
23
src/result.rs
Normal file
23
src/result.rs
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
use std::error::Error;
|
||||
use log::error;
|
||||
|
||||
pub trait ResultExtension{
|
||||
type Output;
|
||||
|
||||
fn display_err_or_some(self) -> Option<Self::Output>;
|
||||
}
|
||||
|
||||
impl<T, U: Error> ResultExtension for Result<T, U>{
|
||||
type Output = T;
|
||||
|
||||
fn display_err_or_some(self) -> Option<Self::Output> {
|
||||
match self{
|
||||
Ok(v) => Some(v),
|
||||
Err(e) => {
|
||||
error!("{}", e);
|
||||
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue