summaryrefslogtreecommitdiff
path: root/src/status.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/status.rs')
-rw-r--r--src/status.rs42
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 @@
1use crate::error::EntryError;
2use std::fmt;
3
4#[derive(Debug)]
5pub struct PullStatus {
6 count: usize,
7 errors: Vec<EntryError>,
8}
9
10impl PullStatus {
11 pub fn new(count: usize, errors: Vec<EntryError>) -> Self {
12 Self { count, errors }
13 }
14}
15
16impl 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)]
28pub struct StoreStatus {
29 count: usize,
30}
31
32impl StoreStatus {
33 pub fn new(count: usize) -> Self {
34 Self { count }
35 }
36}
37
38impl fmt::Display for StoreStatus {
39 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
40 write!(f, "stored {} feeds", self.count,)
41 }
42}