Skip to content

Commit 4c0a005

Browse files
committed
feat(api): immutable setter methods
1 parent bd45ae9 commit 4c0a005

File tree

4 files changed

+59
-6
lines changed

4 files changed

+59
-6
lines changed

Cargo.lock

Lines changed: 52 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ cli-completions = ["cli"]
5252
pipe-trait = "^0.4.0"
5353
smart-default = "^0.7.1"
5454
derive_more = { version = "^2.0.1", features = ["full"] }
55+
derive_setters = "^0.1.8"
5556
rayon = "^1.10.0"
5657
text-block-macros = "^0.2.0"
5758
rounded-div = "^0.1.2"

src/args.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@ pub use threads::Threads;
88

99
use crate::{bytes_format::BytesFormat, visualizer::ColumnWidthDistribution};
1010
use clap::{ColorChoice, Parser};
11+
use derive_setters::Setters;
1112
use smart_default::SmartDefault;
1213
use std::{num::NonZeroU64, path::PathBuf};
1314
use terminal_size::{terminal_size, Width};
1415
use text_block_macros::text_block;
1516

1617
/// The CLI arguments.
17-
#[derive(Debug, SmartDefault, Clone, Parser)]
18+
#[derive(Debug, SmartDefault, Setters, Clone, Parser)]
1819
#[clap(
1920
name = "pdu",
2021
@@ -78,6 +79,7 @@ use text_block_macros::text_block;
7879
7980
color = ColorChoice::Never,
8081
)]
82+
#[setters(prefix = "with_")]
8183
#[non_exhaustive]
8284
pub struct Args {
8385
/// List of files and/or directories.

src/reporter/progress_report.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
use crate::{size, status_board::GLOBAL_STATUS_BOARD};
2+
use derive_setters::Setters;
23
use std::fmt::Write;
34

45
/// Scan progress.
5-
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
6+
#[derive(Debug, Default, Setters, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
7+
#[setters(prefix = "with_")]
68
pub struct ProgressReport<Size: size::Size> {
79
/// Number of scanned items.
810
pub items: u64,

0 commit comments

Comments
 (0)