Debian Codegraph @

src/common/pki/output.rs

raw
1 use openpgp::packet::UserID;
2 use openpgp::Fingerprint;
3 use openpgp::Result;
4 use sequoia_openpgp as openpgp;
5
6 use sequoia_wot as wot;
7 use wot::Path;
8
9 pub use concise_human_readable::print_path;
10 pub use concise_human_readable::print_path_error;
11 pub use concise_human_readable::print_path_header;
12
13 mod concise_human_readable;
14 pub use concise_human_readable::ConciseHumanReadableOutputNetwork;
15
16 /// Trait to implement adding of Paths and outputting them in a specific format
17 ///
18 /// This trait is implemented to consume a vector of Path, trust amount tuples,
19 /// a target Fingerprint, a target UserID, and aggregated trust amount (for the
20 /// target UserID) to allow further processing and eventual output in a desired
21 /// output format.
22 pub trait OutputType {
23 /// Starts emitting a new cert.
24 ///
25 /// Must be called before calling [`OutputType::add_paths`] with a
26 /// new fingerprint.
27 fn add_cert(&mut self, fingerprint: &Fingerprint) -> Result<()>;
28
29 /// Add Paths for a UserID associated with a Fingerprint
30 ///
31 /// Paths are provided in a vector of Path, trust amount tuples.
32 /// The aggregated_amount represents the (total) trust amount (derived from
33 /// the Paths) for the UserID associated with the Fingerprint
34 fn add_paths(
35 &mut self,
36 paths: Vec<(Path, usize)>,
37 fingerprint: &Fingerprint,
38 userid: &UserID,
39 aggregated_amount: usize,
40 ) -> Result<()>;
41
42 /// Output the data consumed via add_paths() in a specific output format
43 fn finalize(&mut self) -> Result<()>;
44 }