diff options
author | Lars Wirzenius <liw@liw.fi> | 2021-12-31 09:00:21 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2021-12-31 12:10:10 +0200 |
commit | acf1ba3f8f1492b961c9a6eb09eb93e882f5eb3f (patch) | |
tree | 1ce0288f878cac71990bb01f358d6035f1626c92 /src/policy.rs | |
parent | 686e87981db210fa443404c8473dfe7a3f39b241 (diff) | |
download | obnam2-acf1ba3f8f1492b961c9a6eb09eb93e882f5eb3f.tar.gz |
docs: add documentation comments to crate
Also, make it an error for a public symbol to not be documented.
Sponsored-by: author
Diffstat (limited to 'src/policy.rs')
-rw-r--r-- | src/policy.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/policy.rs b/src/policy.rs index 39c73fc..9b66c1d 100644 --- a/src/policy.rs +++ b/src/policy.rs @@ -1,14 +1,18 @@ +//! Policy for what gets backed up. + use crate::backup_reason::Reason; use crate::fsentry::FilesystemEntry; use crate::generation::LocalGeneration; use log::{debug, warn}; +/// Policy for what gets backed up. pub struct BackupPolicy { new: bool, old_if_changed: bool, } impl BackupPolicy { + /// Create a default policy. pub fn default() -> Self { Self { new: true, @@ -16,6 +20,7 @@ impl BackupPolicy { } } + /// Does a given file need to be backed up? pub fn needs_backup(&self, old: &LocalGeneration, new_entry: &FilesystemEntry) -> Reason { let new_name = new_entry.pathbuf(); let reason = match old.get_file(&new_name) { |