diff options
Diffstat (limited to 'src/status.rs')
-rw-r--r-- | src/status.rs | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/status.rs b/src/status.rs new file mode 100644 index 0000000..6874e88 --- /dev/null +++ b/src/status.rs | |||
@@ -0,0 +1,42 @@ | |||
1 | use crate::error::EntryError; | ||
2 | use std::fmt; | ||
3 | |||
4 | #[derive(Debug)] | ||
5 | pub struct PullStatus { | ||
6 | count: usize, | ||
7 | errors: Vec<EntryError>, | ||
8 | } | ||
9 | |||
10 | impl PullStatus { | ||
11 | pub fn new(count: usize, errors: Vec<EntryError>) -> Self { | ||
12 | Self { count, errors } | ||
13 | } | ||
14 | } | ||
15 | |||
16 | impl fmt::Display for PullStatus { | ||
17 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | ||
18 | write!( | ||
19 | f, | ||
20 | "pulled {} entries with {} errors", | ||
21 | self.count, | ||
22 | self.errors.len() | ||
23 | ) | ||
24 | } | ||
25 | } | ||
26 | |||
27 | #[derive(Debug)] | ||
28 | pub struct StoreStatus { | ||
29 | count: usize, | ||
30 | } | ||
31 | |||
32 | impl StoreStatus { | ||
33 | pub fn new(count: usize) -> Self { | ||
34 | Self { count } | ||
35 | } | ||
36 | } | ||
37 | |||
38 | impl fmt::Display for StoreStatus { | ||
39 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | ||
40 | write!(f, "stored {} feeds", self.count,) | ||
41 | } | ||
42 | } | ||