Struct rebackup::config::WalkerRule [−][src]
Walker rule (run on individual items)
use rebackup::config::*; let rule = WalkerRule { // Name of the rule name: "nomedia", // Optional description of the rule description: None, // The type of items the rule applies to (`None` for all) only_for: Some(WalkerItemType::Directory), // Check if the rule would match a specific item matches: Box::new(|path, _, _| path.join(".nomedia").is_file()), // Apply the rule to determine what to do action: Box::new(|_, _, _| Ok(WalkerRuleResult::ExcludeItem)), };
Fields
name: &'static str
Rule’s name
description: Option<String>
Rule’s optional description
only_for: Option<WalkerItemType>
Indicate if the rule should only be applied on a specific type of filesystem items
matches: Box<dyn Fn(&Path, &WalkerConfig, &Path) -> bool>
Predicate to indicate if the rule should be run on a specific item.
The checking should be as fast as possible, the goal of this callback being to not having as much overhad as action
.
Arguments are the item’s absolute path, the walker’s configuration, as well as the source directory (absolute, canonicalized)
action: Box<dyn Fn(&Path, &WalkerConfig, &Path) -> Result<WalkerRuleResult, Error>>
Action to perform when the rule is applies on a specific item
Arguments are the item’s absolute path, the walker’s configuration, as well as the source directory (absolute, canonicalized)
Auto Trait Implementations
impl !RefUnwindSafe for WalkerRule
impl !Send for WalkerRule
impl !Sync for WalkerRule
impl Unpin for WalkerRule
impl !UnwindSafe for WalkerRule
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,