[][src]Struct cargo_workspace2::models::Crate

pub struct Crate {
    pub id: CrateId,
    pub name: String,
    pub cc: CargoCrate,
    pub dependencies: BTreeSet<CrateId>,
}

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: CrateId

Numeric Id of this crate

name: String

Package name, not the folder name

cc: CargoCrate

Path offset of the workspace root

dependencies: BTreeSet<CrateId>

List of dependencies this crate has inside this workspace

Implementations

impl Crate[src]

pub fn new(cc: CargoCrate) -> Self[src]

pub fn process(&mut self, g: &DepGraph)[src]

Call this function once all crates have been loaded into scope

pub fn name(&self) -> &String[src]

Get the crate name

pub fn path(&self) -> &PathBuf[src]

Get the crate path

pub fn version(&self) -> String[src]

Get the current version

pub fn add_dependency(&mut self, id: CrateId)[src]

Add a dependency of this crate

pub fn has_dependency(&self, id: CrateId) -> bool[src]

Check if this crate has a particular dependency

pub fn change_dependency(&mut self, dep: &String, new_ver: &String)[src]

pub fn publish(&mut self, new_version: String)[src]

Publish a new version of this crate

pub fn sync(&mut self)[src]

Trait Implementations

impl Clone for Crate[src]

impl Debug for Crate[src]

impl Eq for Crate[src]

impl Ord for Crate[src]

impl PartialEq<Crate> for Crate[src]

impl PartialOrd<Crate> for Crate[src]

Auto Trait Implementations

impl RefUnwindSafe for Crate

impl Send for Crate

impl Sync for Crate

impl Unpin for Crate

impl UnwindSafe for Crate

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.