Skip to content

Commit 951cc57

Browse files
committed
feat(api): better names
1 parent 9740739 commit 951cc57

1 file changed

Lines changed: 15 additions & 15 deletions

File tree

src/hardlink/hardlink_list/summary.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub struct Summary<Size> {
2020
/// Number of [shared inodes](Self::inodes) that don't have links outside the measured tree.
2121
///
2222
/// This number is expected to be less than or equal to [`Self::inodes`].
23-
pub owned_inodes: usize,
23+
pub exclusive_inodes: usize,
2424

2525
/// Totality of the numbers of links of all [shared inodes](Self::inodes).
2626
pub all_links: u64,
@@ -33,15 +33,15 @@ pub struct Summary<Size> {
3333
/// Total number of links of [shared inodes](Self::inodes) that don't have links outside the measured tree.
3434
///
3535
/// This number is expected to be less than or equal to [`Self::all_links`].
36-
pub owned_links: usize,
36+
pub exclusive_links: usize,
3737

3838
/// Totality of the sizes of all [shared inodes](Self::inodes).
3939
pub shared_size: Size,
4040

4141
/// Totality of the sizes of all [shared inodes](Self::inodes) that don't have links outside the measured tree.
4242
///
4343
/// This number is expected to be less than or equal to [`Self::all_links`].
44-
pub owned_shared_size: Size,
44+
pub exclusive_shared_size: Size,
4545
}
4646

4747
/// Ability to summarize into a [`Summary`].
@@ -82,9 +82,9 @@ where
8282
match links.cmp(&(paths as u64)) {
8383
Ordering::Greater => {}
8484
Ordering::Equal => {
85-
summary.owned_inodes += 1;
86-
summary.owned_links += paths; // `links` and `paths` are both fine, but `paths` doesn't require type cast
87-
summary.owned_shared_size += size;
85+
summary.exclusive_inodes += 1;
86+
summary.exclusive_links += paths; // `links` and `paths` are both fine, but `paths` doesn't require type cast
87+
summary.exclusive_shared_size += size;
8888
}
8989
Ordering::Less => {
9090
panic!("Impossible! Total of nlink ({links}) is less than detected paths ({paths}). Something must have gone wrong!");
@@ -135,16 +135,16 @@ impl<Size: size::Size> Display for SummaryDisplay<'_, Size> {
135135
let SummaryDisplay { format, summary } = self;
136136
let Summary {
137137
inodes,
138-
owned_inodes,
138+
exclusive_inodes,
139139
all_links,
140140
detected_links,
141-
owned_links,
141+
exclusive_links,
142142
shared_size,
143-
owned_shared_size,
143+
exclusive_shared_size,
144144
} = summary;
145145

146146
let shared_size = shared_size.display(*format);
147-
let owned_shared_size = owned_shared_size.display(*format);
147+
let exclusive_shared_size = exclusive_shared_size.display(*format);
148148

149149
macro_rules! ln {
150150
($($args:tt)*) => {
@@ -153,21 +153,21 @@ impl<Size: size::Size> Display for SummaryDisplay<'_, Size> {
153153
}
154154

155155
write!(f, "Hardlinks detected! ")?;
156-
if owned_inodes == inodes {
156+
if exclusive_inodes == inodes {
157157
ln!("No files have links outside this tree")?;
158158
ln!("* Number of shared inodes: {inodes}")?;
159159
ln!("* Total number of links: {all_links}")?;
160160
ln!("* Total shared size: {shared_size}")?;
161-
} else if owned_inodes == &0 {
161+
} else if exclusive_inodes == &0 {
162162
ln!("All hardlinks within this tree have links without")?;
163163
ln!("* Number of shared inodes: {inodes}")?;
164164
ln!("* Total number of links: {all_links} total, {detected_links} detected")?;
165165
ln!("* Total shared size: {shared_size}")?;
166166
} else {
167167
ln!("Some files have links outside this tree")?;
168-
ln!("* Number of shared inodes: {inodes} total, {owned_inodes} exclusive")?;
169-
ln!("* Total number of links: {all_links} total, {detected_links} detected, {owned_links} exclusive")?;
170-
ln!("* Total shared size: {shared_size} total, {owned_shared_size} exclusive")?;
168+
ln!("* Number of shared inodes: {inodes} total, {exclusive_inodes} exclusive")?;
169+
ln!("* Total number of links: {all_links} total, {detected_links} detected, {exclusive_links} exclusive")?;
170+
ln!("* Total shared size: {shared_size} total, {exclusive_shared_size} exclusive")?;
171171
}
172172

173173
Ok(())

0 commit comments

Comments
 (0)