pub struct ChangeDetectionBuilder { /* private fields */ }
Expand description
A change detection builder.
A builder to generate change detection instructions.
You should not use this directly, use ChangeDetection
as an entry point instead.
Implementations§
Source§impl ChangeDetectionBuilder
impl ChangeDetectionBuilder
Sourcepub fn path<P>(self, path: P) -> ChangeDetectionBuilderwhere
P: Into<ChangeDetectionPath>,
pub fn path<P>(self, path: P) -> ChangeDetectionBuilderwhere
P: Into<ChangeDetectionPath>,
Collects change detection instructions from a path
.
A path
can be a single file or a directory.
§Examples:
To generate change instructions for the directory with the name static
:
builder.path("static").generate();
To generate change instructions for the file with the name build.rs
:
builder.path("build.rs").generate();
Sourcepub fn path_include<P, F>(self, path: P, filter: F) -> ChangeDetectionBuilder
pub fn path_include<P, F>(self, path: P, filter: F) -> ChangeDetectionBuilder
Collects change detection instructions from a path
applying include filter
.
A path
can be a single file or a directory.
§Examples:
To generate change instructions for the directory with the name static
but only for files ending with b
:
builder.path_include("static", |path: &std::path::Path| {
path.file_name()
.map(|filename| filename.to_str().unwrap().ends_with("b"))
.unwrap_or(false)
}).generate();
Sourcepub fn path_exclude<P, F>(self, path: P, filter: F) -> ChangeDetectionBuilder
pub fn path_exclude<P, F>(self, path: P, filter: F) -> ChangeDetectionBuilder
Collects change detection instructions from a path
applying exclude filter
.
A path
can be a single file or a directory.
§Examples:
To generate change instructions for the directory with the name static
but without files ending with b
:
builder.path_exclude("static", |path: &std::path::Path| {
path.file_name()
.map(|filename| filename.to_str().unwrap().ends_with("b"))
.unwrap_or(false)
}).generate();
Sourcepub fn path_filter<P, F1, F2>(
self,
path: P,
include: F1,
exclude: F2,
) -> ChangeDetectionBuilder
pub fn path_filter<P, F1, F2>( self, path: P, include: F1, exclude: F2, ) -> ChangeDetectionBuilder
Collects change detection instructions from a path
applying include
and exclude
filters.
A path
can be a single file or a directory.
§Examples:
To generate change instructions for the directory with the name static
including only files starting with a
but without files ending with b
:
builder.path_filter("static", |path: &std::path::Path| {
path.file_name()
.map(|filename| filename.to_str().unwrap().starts_with("a"))
.unwrap_or(false)
}, |path: &std::path::Path| {
path.file_name()
.map(|filename| filename.to_str().unwrap().ends_with("b"))
.unwrap_or(false)
}).generate();