1use crate::{package::RemotePackage, PackageName};
2
3#[cfg(all(feature = "indicatif", feature = "library"))]
4pub use self::indicatif::IndicatifCallback;
5#[cfg(feature = "library")]
6pub use self::plain::PlainCallback;
7pub use self::silent::SilentCallback;
8#[cfg(feature = "library")]
9use crate::{backend::Error, PackageList};
10#[cfg(all(feature = "indicatif", feature = "library"))]
11mod indicatif;
12#[cfg(feature = "library")]
13mod plain;
14mod silent;
15
16pub trait Callback {
18 fn fetch_start(&mut self, initial_count: usize);
19 fn fetch_package_name(&mut self, pkg_name: &PackageName);
20 fn fetch_package_increment(&mut self, added_processed: usize, added_count: usize);
21 fn fetch_end(&mut self);
22
23 #[cfg(feature = "library")]
24 fn install_prompt(&mut self, list: &PackageList) -> Result<(), Error>;
25 #[cfg(feature = "library")]
26 fn install_check_conflict(
27 &mut self,
28 list: &Vec<pkgar::TransactionConflict>,
29 ) -> Result<(), Error>;
30 fn install_extract(&mut self, pkg_name: &RemotePackage);
31
32 fn download_start(&mut self, length: u64, file: &str);
33 fn download_increment(&mut self, downloaded: u64);
34 fn download_end(&mut self);
35
36 #[cfg(feature = "library")]
37 fn commit_start(&mut self, count: usize);
38 #[cfg(feature = "library")]
39 fn commit_increment(&mut self, file: &pkgar::Transaction);
40 #[cfg(feature = "library")]
41 fn commit_end(&mut self);
42
43 #[cfg(feature = "library")]
44 fn abort_start(&mut self, count: usize);
45 #[cfg(feature = "library")]
46 fn abort_increment(&mut self, file: &pkgar::Transaction);
47 #[cfg(feature = "library")]
48 fn abort_end(&mut self);
49}