MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / matches_prefix

Method matches_prefix

atomic-core/src/output/repo/tree.rs:294–300  ·  view source on GitHub ↗

Check if a path matches the prefix filter. # Arguments `path` - Path to check # Returns `true` if the path is under the prefix. # Example ```rust use atomic_core::output::repo::TreeCollectOptions; let opts = TreeCollectOptions::new().prefix("src/"); assert!(opts.matches_prefix("src/main.rs")); assert!(opts.matches_prefix("src/lib/mod.rs")); assert!(!opts.matches_prefix("tests/test.rs")); ``

(&self, path: &str)

Source from the content-addressed store, hash-verified

292 /// assert!(!opts.matches_prefix("tests/test.rs"));
293 /// ```
294 pub fn matches_prefix(&self, path: &str) -> bool {
295 if self.prefix.is_empty() {
296 true
297 } else {
298 path.starts_with(&self.prefix)
299 }
300 }
301
302 /// Check if a path should be excluded.
303 ///

Callers 1

should_includeMethod · 0.45

Calls 1

is_emptyMethod · 0.45

Tested by

no test coverage detected