pub struct Crate {
pub id: CrateId,
pub name: String,
pub cc: CargoCrate,
pub dependencies: BTreeSet<CrateId>,
}Expand description
A crate in a cargo workspace
Has a name, path (stored as the offset of the root), and set of dependencies inside the workspace. To get the dependents of this crate, query the dependency graph with the set of other crate IDs.
Fields§
§id: CrateIdNumeric Id of this crate
name: StringPackage name, not the folder name
cc: CargoCratePath offset of the workspace root
dependencies: BTreeSet<CrateId>List of dependencies this crate has inside this workspace
Implementations§
Source§impl Crate
impl Crate
pub fn new(cc: CargoCrate) -> Self
Sourcepub fn process(&mut self, g: &DepGraph)
pub fn process(&mut self, g: &DepGraph)
Call this function once all crates have been loaded into scope
Sourcepub fn add_dependency(&mut self, id: CrateId)
pub fn add_dependency(&mut self, id: CrateId)
Add a dependency of this crate
Sourcepub fn has_dependency(&self, id: CrateId) -> bool
pub fn has_dependency(&self, id: CrateId) -> bool
Check if this crate has a particular dependency
pub fn change_dependency(&mut self, dep: &String, new_ver: &String)
pub fn sync(&mut self)
Trait Implementations§
Source§impl Ord for Crate
impl Ord for Crate
Source§impl PartialOrd for Crate
impl PartialOrd for Crate
impl Eq for Crate
Auto Trait Implementations§
impl Freeze for Crate
impl RefUnwindSafe for Crate
impl Send for Crate
impl Sync for Crate
impl Unpin for Crate
impl UnsafeUnpin for Crate
impl UnwindSafe for Crate
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