Skip to content

Commit

Permalink
rustic_core: Add NoProgress and NoProgressBars (e.g. for examples)
Browse files Browse the repository at this point in the history
  • Loading branch information
aawsome committed Jun 18, 2023
1 parent 2a7a78b commit 9001fd2
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion crates/rustic_core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ pub use crate::{
indexer::Indexer,
IndexBackend, IndexEntry, IndexedBackend, ReadIndex,
},
progress::{Progress, ProgressBars},
progress::{NoProgress, NoProgressBars, Progress, ProgressBars},
repofile::{
configfile::ConfigFile,
indexfile::{IndexBlob, IndexFile, IndexPack},
Expand Down
29 changes: 29 additions & 0 deletions crates/rustic_core/src/progress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,32 @@ pub trait ProgressBars {
fn progress_hidden(&self) -> Self::P;
fn progress_bytes(&self, prefix: impl Into<Cow<'static, str>>) -> Self::P;
}

#[derive(Clone)]
pub struct NoProgress;

Check failure on line 20 in crates/rustic_core/src/progress.rs

View workflow job for this annotation

GitHub Actions / Clippy Output

type could implement `Copy`; consider adding `impl Copy`

error: type could implement `Copy`; consider adding `impl Copy` --> crates/rustic_core/src/progress.rs:20:1 | 20 | pub struct NoProgress; | ^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D missing-copy-implementations` implied by `-D warnings`

Check failure on line 20 in crates/rustic_core/src/progress.rs

View workflow job for this annotation

GitHub Actions / Clippy Output

type does not implement `std::fmt::Debug`; consider adding `#[derive(Debug)]` or a manual implementation

error: type does not implement `std::fmt::Debug`; consider adding `#[derive(Debug)]` or a manual implementation --> crates/rustic_core/src/progress.rs:20:1 | 20 | pub struct NoProgress; | ^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D missing-debug-implementations` implied by `-D warnings`

Check warning on line 20 in crates/rustic_core/src/progress.rs

View workflow job for this annotation

GitHub Actions / Check

type does not implement `std::fmt::Debug`; consider adding `#[derive(Debug)]` or a manual implementation

Check warning on line 20 in crates/rustic_core/src/progress.rs

View workflow job for this annotation

GitHub Actions / Check

type could implement `Copy`; consider adding `impl Copy`

Check warning on line 20 in crates/rustic_core/src/progress.rs

View workflow job for this annotation

GitHub Actions / Publishing x86_64-unknown-linux-gnu

type does not implement `std::fmt::Debug`; consider adding `#[derive(Debug)]` or a manual implementation

Check warning on line 20 in crates/rustic_core/src/progress.rs

View workflow job for this annotation

GitHub Actions / Publishing x86_64-unknown-linux-gnu

type could implement `Copy`; consider adding `impl Copy`

Check warning on line 20 in crates/rustic_core/src/progress.rs

View workflow job for this annotation

GitHub Actions / Publishing x86_64-unknown-linux-musl

type does not implement `std::fmt::Debug`; consider adding `#[derive(Debug)]` or a manual implementation

Check warning on line 20 in crates/rustic_core/src/progress.rs

View workflow job for this annotation

GitHub Actions / Publishing x86_64-unknown-linux-musl

type could implement `Copy`; consider adding `impl Copy`

Check warning on line 20 in crates/rustic_core/src/progress.rs

View workflow job for this annotation

GitHub Actions / Publishing i686-unknown-linux-gnu

type does not implement `std::fmt::Debug`; consider adding `#[derive(Debug)]` or a manual implementation

Check warning on line 20 in crates/rustic_core/src/progress.rs

View workflow job for this annotation

GitHub Actions / Publishing i686-unknown-linux-gnu

type could implement `Copy`; consider adding `impl Copy`

Check warning on line 20 in crates/rustic_core/src/progress.rs

View workflow job for this annotation

GitHub Actions / Publishing aarch64-unknown-linux-gnu

type does not implement `std::fmt::Debug`; consider adding `#[derive(Debug)]` or a manual implementation

Check warning on line 20 in crates/rustic_core/src/progress.rs

View workflow job for this annotation

GitHub Actions / Publishing aarch64-unknown-linux-gnu

type could implement `Copy`; consider adding `impl Copy`

Check warning on line 20 in crates/rustic_core/src/progress.rs

View workflow job for this annotation

GitHub Actions / Publishing x86_64-unknown-netbsd

type does not implement `std::fmt::Debug`; consider adding `#[derive(Debug)]` or a manual implementation

Check warning on line 20 in crates/rustic_core/src/progress.rs

View workflow job for this annotation

GitHub Actions / Publishing x86_64-unknown-netbsd

type could implement `Copy`; consider adding `impl Copy`

Check warning on line 20 in crates/rustic_core/src/progress.rs

View workflow job for this annotation

GitHub Actions / Test (stable, ubuntu-latest)

type does not implement `std::fmt::Debug`; consider adding `#[derive(Debug)]` or a manual implementation

Check warning on line 20 in crates/rustic_core/src/progress.rs

View workflow job for this annotation

GitHub Actions / Test (stable, ubuntu-latest)

type could implement `Copy`; consider adding `impl Copy`

Check warning on line 20 in crates/rustic_core/src/progress.rs

View workflow job for this annotation

GitHub Actions / Publishing aarch64-apple-darwin

type does not implement `std::fmt::Debug`; consider adding `#[derive(Debug)]` or a manual implementation

Check warning on line 20 in crates/rustic_core/src/progress.rs

View workflow job for this annotation

GitHub Actions / Publishing aarch64-apple-darwin

type could implement `Copy`; consider adding `impl Copy`

Check warning on line 20 in crates/rustic_core/src/progress.rs

View workflow job for this annotation

GitHub Actions / Test (stable, macos-latest)

type does not implement `std::fmt::Debug`; consider adding `#[derive(Debug)]` or a manual implementation

Check warning on line 20 in crates/rustic_core/src/progress.rs

View workflow job for this annotation

GitHub Actions / Test (stable, macos-latest)

type could implement `Copy`; consider adding `impl Copy`

Check warning on line 20 in crates/rustic_core/src/progress.rs

View workflow job for this annotation

GitHub Actions / Publishing x86_64-pc-windows-msvc

type does not implement `std::fmt::Debug`; consider adding `#[derive(Debug)]` or a manual implementation

Check warning on line 20 in crates/rustic_core/src/progress.rs

View workflow job for this annotation

GitHub Actions / Publishing x86_64-pc-windows-msvc

type could implement `Copy`; consider adding `impl Copy`

Check warning on line 20 in crates/rustic_core/src/progress.rs

View workflow job for this annotation

GitHub Actions / Publishing x86_64-apple-darwin

type does not implement `std::fmt::Debug`; consider adding `#[derive(Debug)]` or a manual implementation

Check warning on line 20 in crates/rustic_core/src/progress.rs

View workflow job for this annotation

GitHub Actions / Publishing x86_64-apple-darwin

type could implement `Copy`; consider adding `impl Copy`

Check warning on line 20 in crates/rustic_core/src/progress.rs

View workflow job for this annotation

GitHub Actions / Test (stable, windows-latest)

type does not implement `std::fmt::Debug`; consider adding `#[derive(Debug)]` or a manual implementation

Check warning on line 20 in crates/rustic_core/src/progress.rs

View workflow job for this annotation

GitHub Actions / Test (stable, windows-latest)

type could implement `Copy`; consider adding `impl Copy`
impl Progress for NoProgress {
fn is_hidden(&self) -> bool {
true
}
fn set_length(&self, _len: u64) {}
fn set_title(&self, _title: &'static str) {}
fn inc(&self, _inc: u64) {}
fn finish(&self) {}
}

pub struct NoProgressBars;

Check failure on line 31 in crates/rustic_core/src/progress.rs

View workflow job for this annotation

GitHub Actions / Clippy Output

type could implement `Copy`; consider adding `impl Copy`

error: type could implement `Copy`; consider adding `impl Copy` --> crates/rustic_core/src/progress.rs:31:1 | 31 | pub struct NoProgressBars; | ^^^^^^^^^^^^^^^^^^^^^^^^^^

Check failure on line 31 in crates/rustic_core/src/progress.rs

View workflow job for this annotation

GitHub Actions / Clippy Output

type does not implement `std::fmt::Debug`; consider adding `#[derive(Debug)]` or a manual implementation

error: type does not implement `std::fmt::Debug`; consider adding `#[derive(Debug)]` or a manual implementation --> crates/rustic_core/src/progress.rs:31:1 | 31 | pub struct NoProgressBars; | ^^^^^^^^^^^^^^^^^^^^^^^^^^

Check warning on line 31 in crates/rustic_core/src/progress.rs

View workflow job for this annotation

GitHub Actions / Check

type does not implement `std::fmt::Debug`; consider adding `#[derive(Debug)]` or a manual implementation

Check warning on line 31 in crates/rustic_core/src/progress.rs

View workflow job for this annotation

GitHub Actions / Check

type could implement `Copy`; consider adding `impl Copy`

Check warning on line 31 in crates/rustic_core/src/progress.rs

View workflow job for this annotation

GitHub Actions / Publishing x86_64-unknown-linux-gnu

type does not implement `std::fmt::Debug`; consider adding `#[derive(Debug)]` or a manual implementation

Check warning on line 31 in crates/rustic_core/src/progress.rs

View workflow job for this annotation

GitHub Actions / Publishing x86_64-unknown-linux-gnu

type could implement `Copy`; consider adding `impl Copy`

Check warning on line 31 in crates/rustic_core/src/progress.rs

View workflow job for this annotation

GitHub Actions / Publishing x86_64-unknown-linux-musl

type does not implement `std::fmt::Debug`; consider adding `#[derive(Debug)]` or a manual implementation

Check warning on line 31 in crates/rustic_core/src/progress.rs

View workflow job for this annotation

GitHub Actions / Publishing x86_64-unknown-linux-musl

type could implement `Copy`; consider adding `impl Copy`

Check warning on line 31 in crates/rustic_core/src/progress.rs

View workflow job for this annotation

GitHub Actions / Publishing i686-unknown-linux-gnu

type does not implement `std::fmt::Debug`; consider adding `#[derive(Debug)]` or a manual implementation

Check warning on line 31 in crates/rustic_core/src/progress.rs

View workflow job for this annotation

GitHub Actions / Publishing i686-unknown-linux-gnu

type could implement `Copy`; consider adding `impl Copy`

Check warning on line 31 in crates/rustic_core/src/progress.rs

View workflow job for this annotation

GitHub Actions / Publishing aarch64-unknown-linux-gnu

type does not implement `std::fmt::Debug`; consider adding `#[derive(Debug)]` or a manual implementation

Check warning on line 31 in crates/rustic_core/src/progress.rs

View workflow job for this annotation

GitHub Actions / Publishing aarch64-unknown-linux-gnu

type could implement `Copy`; consider adding `impl Copy`

Check warning on line 31 in crates/rustic_core/src/progress.rs

View workflow job for this annotation

GitHub Actions / Publishing x86_64-unknown-netbsd

type does not implement `std::fmt::Debug`; consider adding `#[derive(Debug)]` or a manual implementation

Check warning on line 31 in crates/rustic_core/src/progress.rs

View workflow job for this annotation

GitHub Actions / Publishing x86_64-unknown-netbsd

type could implement `Copy`; consider adding `impl Copy`

Check warning on line 31 in crates/rustic_core/src/progress.rs

View workflow job for this annotation

GitHub Actions / Test (stable, ubuntu-latest)

type does not implement `std::fmt::Debug`; consider adding `#[derive(Debug)]` or a manual implementation

Check warning on line 31 in crates/rustic_core/src/progress.rs

View workflow job for this annotation

GitHub Actions / Test (stable, ubuntu-latest)

type could implement `Copy`; consider adding `impl Copy`

Check warning on line 31 in crates/rustic_core/src/progress.rs

View workflow job for this annotation

GitHub Actions / Publishing aarch64-apple-darwin

type does not implement `std::fmt::Debug`; consider adding `#[derive(Debug)]` or a manual implementation

Check warning on line 31 in crates/rustic_core/src/progress.rs

View workflow job for this annotation

GitHub Actions / Publishing aarch64-apple-darwin

type could implement `Copy`; consider adding `impl Copy`

Check warning on line 31 in crates/rustic_core/src/progress.rs

View workflow job for this annotation

GitHub Actions / Test (stable, macos-latest)

type does not implement `std::fmt::Debug`; consider adding `#[derive(Debug)]` or a manual implementation

Check warning on line 31 in crates/rustic_core/src/progress.rs

View workflow job for this annotation

GitHub Actions / Test (stable, macos-latest)

type could implement `Copy`; consider adding `impl Copy`

Check warning on line 31 in crates/rustic_core/src/progress.rs

View workflow job for this annotation

GitHub Actions / Publishing x86_64-pc-windows-msvc

type does not implement `std::fmt::Debug`; consider adding `#[derive(Debug)]` or a manual implementation

Check warning on line 31 in crates/rustic_core/src/progress.rs

View workflow job for this annotation

GitHub Actions / Publishing x86_64-pc-windows-msvc

type could implement `Copy`; consider adding `impl Copy`

Check warning on line 31 in crates/rustic_core/src/progress.rs

View workflow job for this annotation

GitHub Actions / Publishing x86_64-apple-darwin

type does not implement `std::fmt::Debug`; consider adding `#[derive(Debug)]` or a manual implementation

Check warning on line 31 in crates/rustic_core/src/progress.rs

View workflow job for this annotation

GitHub Actions / Publishing x86_64-apple-darwin

type could implement `Copy`; consider adding `impl Copy`

Check warning on line 31 in crates/rustic_core/src/progress.rs

View workflow job for this annotation

GitHub Actions / Test (stable, windows-latest)

type does not implement `std::fmt::Debug`; consider adding `#[derive(Debug)]` or a manual implementation

Check warning on line 31 in crates/rustic_core/src/progress.rs

View workflow job for this annotation

GitHub Actions / Test (stable, windows-latest)

type could implement `Copy`; consider adding `impl Copy`
impl ProgressBars for NoProgressBars {
type P = NoProgress;
fn progress_spinner(&self, _prefix: impl Into<Cow<'static, str>>) -> Self::P {
NoProgress
}
fn progress_counter(&self, _prefix: impl Into<Cow<'static, str>>) -> Self::P {
NoProgress
}
fn progress_hidden(&self) -> Self::P {
NoProgress
}
fn progress_bytes(&self, _prefix: impl Into<Cow<'static, str>>) -> Self::P {
NoProgress
}
}

0 comments on commit 9001fd2

Please sign in to comment.