pub struct WorkspaceInfo {
pub root: PathBuf,
pub crates: HashMap<String, CrateInfo>,
pub members: Vec<String>,
pub dependency_graph: HashMap<String, HashSet<String>>,
pub reverse_deps: HashMap<String, HashSet<String>>,
}Expand description
Information about the entire workspace
Fields§
§root: PathBufRoot directory of the workspace
crates: HashMap<String, CrateInfo>All crates in the workspace
members: Vec<String>Workspace members (crate names)
dependency_graph: HashMap<String, HashSet<String>>Dependency graph: crate name -> dependencies
reverse_deps: HashMap<String, HashSet<String>>Reverse dependency graph: crate name -> dependents
Implementations§
Source§impl WorkspaceInfo
impl WorkspaceInfo
Sourcepub fn from_path(path: &Path) -> Result<Self, WorkspaceError>
pub fn from_path(path: &Path) -> Result<Self, WorkspaceError>
Analyze a workspace from a path
Sourcepub fn from_metadata(metadata: Metadata) -> Result<Self, WorkspaceError>
pub fn from_metadata(metadata: Metadata) -> Result<Self, WorkspaceError>
Create workspace info from cargo metadata
Sourcepub fn is_workspace_member(&self, name: &str) -> bool
pub fn is_workspace_member(&self, name: &str) -> bool
Check if a crate is a workspace member
Sourcepub fn get_dependencies(&self, name: &str) -> Option<&HashSet<String>>
pub fn get_dependencies(&self, name: &str) -> Option<&HashSet<String>>
Get direct dependencies of a crate
Sourcepub fn get_dependents(&self, name: &str) -> Option<&HashSet<String>>
pub fn get_dependents(&self, name: &str) -> Option<&HashSet<String>>
Get crates that depend on this crate
Sourcepub fn crate_distance(&self, from: &str, to: &str) -> Option<usize>
pub fn crate_distance(&self, from: &str, to: &str) -> Option<usize>
Calculate the distance between two crates Returns None if there’s no path, 0 if same crate, 1 for direct dep, etc.
Sourcepub fn get_all_source_files(&self) -> Vec<PathBuf>
pub fn get_all_source_files(&self) -> Vec<PathBuf>
Get all source files for workspace members
Trait Implementations§
Auto Trait Implementations§
impl Freeze for WorkspaceInfo
impl RefUnwindSafe for WorkspaceInfo
impl Send for WorkspaceInfo
impl Sync for WorkspaceInfo
impl Unpin for WorkspaceInfo
impl UnwindSafe for WorkspaceInfo
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more