pub struct CrateInfo {
pub name: String,
pub root: PathBuf,
pub src_dirs: Vec<PathBuf>,
pub tests_dir: Option<PathBuf>,
pub examples_dir: Option<PathBuf>,
pub benches_dir: Option<PathBuf>,
}Expand description
Information about a crate in a workspace.
Fields§
§name: StringName of the crate
root: PathBufRoot directory of the crate (where Cargo.toml is)
src_dirs: Vec<PathBuf>Source directories to scan (typically just “src”)
tests_dir: Option<PathBuf>Test directory if it exists
examples_dir: Option<PathBuf>Examples directory if it exists
benches_dir: Option<PathBuf>Benches directory if it exists
Implementations§
Source§impl CrateInfo
impl CrateInfo
Sourcepub fn contains_path(&self, path: &Path, workspace_root: &Path) -> bool
pub fn contains_path(&self, path: &Path, workspace_root: &Path) -> bool
Check if a file path belongs to this crate.
This is used to map arbitrary file paths (e.g., from git diffs) to their owning crate, enabling centralized filtering. Rather than re-implementing crate filtering logic in multiple places, callers should:
- Use this method to find which crate a file belongs to
- Apply crate-level filters using
WorkspaceInfo::filter_by_names()
This design keeps filtering logic centralized in the workspace module.
The path can be absolute or relative to the workspace root.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CrateInfo
impl RefUnwindSafe for CrateInfo
impl Send for CrateInfo
impl Sync for CrateInfo
impl Unpin for CrateInfo
impl UnsafeUnpin for CrateInfo
impl UnwindSafe for CrateInfo
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more