Skip to main content

Engine

Trait Engine 

Source
pub trait Engine {
    // Required methods
    fn matches(
        &self,
        patterns: impl IntoIterator<Item = impl AsRef<Path>>,
    ) -> impl Iterator<Item = Result<PathBuf, PathBuf>>;
    fn resolve(&self, path: impl AsRef<Path>) -> PathBuf;
    fn is_ignored(&self, path: impl AsRef<Path>) -> bool;
    fn is_range_modified(
        &self,
        path: impl AsRef<Path>,
        range: (usize, usize),
    ) -> bool;

    // Provided methods
    fn read_to_string(&self, path: impl AsRef<Path>) -> Result<String, Error> { ... }
    fn check(&self, path: impl AsRef<Path>) -> Result<(), Vec<String>> { ... }
}

Required Methods§

Source

fn matches( &self, patterns: impl IntoIterator<Item = impl AsRef<Path>>, ) -> impl Iterator<Item = Result<PathBuf, PathBuf>>

Iterate over changed files that match the given patterns and patterns that don’t match any file.

If patterns is empty, all changed files are returned.

Source

fn resolve(&self, path: impl AsRef<Path>) -> PathBuf

Resolve a path to an absolute path.

Source

fn is_ignored(&self, path: impl AsRef<Path>) -> bool

Check if a file has been ignored.

Source

fn is_range_modified( &self, path: impl AsRef<Path>, range: (usize, usize), ) -> bool

Check if a range of lines in a file has been modified.

Provided Methods§

Source

fn read_to_string(&self, path: impl AsRef<Path>) -> Result<String, Error>

Read the file content that should be checked.

Source

fn check(&self, path: impl AsRef<Path>) -> Result<(), Vec<String>>

Check a file for dependent changes.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§