unwalk_base/
lib.rs

1#![cfg_attr(feature = "cargo-clippy", deny(clippy))]
2#![deny(missing_debug_implementations, missing_docs, warnings)]
3
4//! # unwalk-base
5//!
6//! Provide basic trait for action on matching files.
7
8#[macro_use]
9extern crate failure;
10
11pub mod error;
12
13use error::Error;
14use std::path::Path;
15
16/// Alias to Result type of performing Action.
17pub type ActionResult = Result<(), Error>;
18
19/// Trait for action on matching files.
20pub trait Action {
21    /// Perform action on given matching file.
22    fn execute<P>(path: P) -> ActionResult
23    where
24        P: AsRef<Path>;
25
26    /// Default file name extension(s) to match to perform the action.
27    fn default_extensions() -> &'static [&'static str];
28}