diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2021-04-06 11:32:58 +0200 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2021-04-06 11:34:25 +0200 |
commit | 0b66d92a37dd368d7bef39b9c02a9d8eeb446115 (patch) | |
tree | c7c4c2dc89bcd79a3f61652c4b463e51e457d6d5 /src/frontend/mod.rs | |
parent | 774a9c331214fc6682c793eb5cf8d666f8774b57 (diff) |
Run cargo-fmt
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'src/frontend/mod.rs')
-rw-r--r-- | src/frontend/mod.rs | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/frontend/mod.rs b/src/frontend/mod.rs index e2dda0e..c9ef381 100644 --- a/src/frontend/mod.rs +++ b/src/frontend/mod.rs @@ -3,22 +3,27 @@ use clap::ArgMatches; use librepology::v1::types::*; +use crate::backend::Backend; +use crate::compare::ComparePackage; use crate::config::Configuration; -use crate::frontend::list::ListFrontend; use crate::frontend::json::JsonFrontend; +use crate::frontend::list::ListFrontend; use crate::frontend::table::TableFrontend; -use crate::compare::ComparePackage; -use crate::backend::Backend; /// A Frontend represents a way to show the data to the user pub trait Frontend { fn list_packages(&self, packages: Vec<Package>) -> Result<()>; fn list_problems(&self, problems: Vec<Problem>) -> Result<()>; - fn compare_packages(&self, packages: Vec<ComparePackage>, backend: &Backend, filter_repos: Vec<Repo>) -> Result<()>; + fn compare_packages( + &self, + packages: Vec<ComparePackage>, + backend: &Backend, + filter_repos: Vec<Repo>, + ) -> Result<()>; } -pub mod list; pub mod json; +pub mod list; pub mod table; /// Helper function for building a new Frontend object based on the commandline parameters @@ -27,19 +32,18 @@ pub fn new_frontend(app: &ArgMatches, _config: &Configuration) -> Result<Box<dyn None | Some("lines") => { debug!("No output specified, using default"); Ok(Box::new(ListFrontend::new(::std::io::stdout()))) - }, + } Some("json") => { debug!("Using JSON Frontend"); Ok(Box::new(JsonFrontend::new(::std::io::stdout()))) - }, + } Some("table") => { debug!("Using table Frontend"); Ok(Box::new(TableFrontend::new(::std::io::stdout()))) - }, + } Some(other) => Err(format_err!("Unknown Frontend '{}'", other)), } - } |