Skip to content

Commit 5c6d827

Browse files
committed
docs: more details
1 parent 755c9ee commit 5c6d827

4 files changed

Lines changed: 12 additions & 6 deletions

File tree

src/hardlink/hardlink_list.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ struct Value<Size> {
2929

3030
/// Storage to be used by [`crate::hardlink::RecordHardlinks`].
3131
///
32-
/// **Serialization and deserialization:** _(feature: `json`)_ `HardlinkList` does not implement
33-
/// `Serialize` and `Deserialize` traits directly, instead, it can be converted into/from a
34-
/// [`Reflection`] which implements these traits.
32+
/// **Reflection:** `HardlinkList` does not implement `PartialEq`, `Eq`, `Hash`,
33+
/// `Deserialize`, and `Serialize` directly. Instead, it can be converted into a
34+
/// [`Reflection`] which implement these traits.
3535
#[derive(Debug, SmartDefault, Clone)]
3636
pub struct HardlinkList<Size>(
3737
/// Map an inode number to its size, number of links, and detected paths.

src/hardlink/hardlink_list/reflection.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,11 @@ use serde::{Deserialize, Serialize};
1111
/// [`HardlinkList`]'s internal content.
1212
///
1313
/// **Guarantees:**
14+
/// * Every inode number is unique.
1415
/// * The internal list is always sorted by inode numbers.
1516
///
17+
/// **Equality and identity:** `Reflection` implements `PartialEq`, `Eq`, and `Hash` traits.
18+
///
1619
/// **Serialization and deserialization:** _(feature: `json`)_ `Reflection` implements
1720
/// `Serialize` and `Deserialize` traits, this allows functions in `serde_json` to convert
1821
/// a `Reflection` into/from JSON.

src/hardlink/link_path_list.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ use std::path::PathBuf;
1010

1111
/// List of different hardlinks to the same file.
1212
///
13-
/// **Serialization and deserialization:** _(feature: `json`)_ `LinkPathList` does not implement
14-
/// `Serialize` and `Deserialize` traits directly, instead, it can be converted into/from a
15-
/// [`Reflection`] which implements these traits.
13+
/// **Reflection:** `LinkPathList` does not implement `PartialEq`, `Eq`, `Hash`,
14+
/// `Deserialize`, and `Serialize` directly. Instead, it can be converted into a
15+
/// [`Reflection`] which implement these traits. Do note that the time complexity
16+
/// of such conversion is O(n) as it has to convert a `Vec` into a `HashSet`.
1617
#[derive(Debug, Clone)]
1718
pub struct LinkPathList(Vec<PathBuf>);
1819

src/hardlink/link_path_list/reflection.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ use serde::{Deserialize, Serialize};
99
/// Intermediate format used for construction and inspection of
1010
/// [`LinkPathList`]'s internal content.
1111
///
12+
/// **Equality and identity:** `Reflection` implements `PartialEq`, `Eq`, and `Hash` traits.
13+
///
1214
/// **Serialization and deserialization:** _(feature: `json`)_ `Reflection` implements
1315
/// `Serialize` and `Deserialize` traits, this allows functions in `serde_json` to convert
1416
/// a `Reflection` into/from JSON.

0 commit comments

Comments
 (0)