diff options
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -3,3 +3,20 @@ pub mod error; | |||
3 | pub mod feed; | 3 | pub mod feed; |
4 | pub mod manager; | 4 | pub mod manager; |
5 | pub mod status; | 5 | pub mod status; |
6 | |||
7 | pub trait PrintResult { | ||
8 | fn print(&self); | ||
9 | } | ||
10 | |||
11 | impl<T, E> PrintResult for Result<T, E> | ||
12 | where | ||
13 | T: std::fmt::Display, | ||
14 | E: std::fmt::Display, | ||
15 | { | ||
16 | fn print(&self) { | ||
17 | match self { | ||
18 | Ok(ok) => println!("{ok}"), | ||
19 | Err(err) => eprintln!("{err}"), | ||
20 | } | ||
21 | } | ||
22 | } | ||