[][src]Struct ra_ap_base_db::CrateGraph

pub struct CrateGraph { /* fields omitted */ }

CrateGraph is a bit of information which turns a set of text files into a number of Rust crates. Each crate is defined by the FileId of its root module, the set of cfg flags (not yet implemented) and the set of dependencies. Note that, due to cfg's, there might be several crates for a single FileId! As in the rust-lang proper, a crate does not have a name. Instead, names are specified on dependency edges. That is, a crate might be known under different names in different dependent crates.

Note that CrateGraph is build-system agnostic: it's a concept of the Rust language proper, not a concept of the build system. In practice, we get CrateGraph by lowering cargo metadata output.


impl CrateGraph[src]

pub fn add_crate_root(
    &mut self,
    file_id: FileId,
    edition: Edition,
    display_name: Option<CrateDisplayName>,
    cfg_options: CfgOptions,
    env: Env,
    proc_macro: Vec<(SmolStr, Arc<dyn TokenExpander>)>
) -> CrateId

pub fn add_dep(
    &mut self,
    from: CrateId,
    name: CrateName,
    to: CrateId
) -> Result<(), CyclicDependenciesError>

pub fn is_empty(&self) -> bool[src]

pub fn iter(&self) -> impl Iterator<Item = CrateId> + '_[src]

pub fn transitive_deps(&self, of: CrateId) -> impl Iterator<Item = CrateId> + '_[src]

Returns an iterator over all transitive dependencies of the given crate.

pub fn crates_in_topological_order(&self) -> Vec<CrateId>[src]

Returns all crates in the graph, sorted in topological order (ie. dependencies of a crate come before the crate itself).

pub fn crate_id_for_crate_root(&self, file_id: FileId) -> Option<CrateId>[src]

pub fn extend(&mut self, other: CrateGraph) -> u32[src]

Extends this crate graph by adding a complete disjoint second crate graph.

The ids of the crates in the other graph are shifted by the return amount.

pub fn patch_cfg_if(&mut self) -> bool[src]

Trait Implementations

impl Clone for CrateGraph[src]

impl Debug for CrateGraph[src]

impl Default for CrateGraph[src]

impl Eq for CrateGraph[src]

impl Index<CrateId> for CrateGraph[src]

type Output = CrateData

The returned type after indexing.

impl PartialEq<CrateGraph> for CrateGraph[src]

impl StructuralEq for CrateGraph[src]

impl StructuralPartialEq for CrateGraph[src]

Auto Trait Implementations

Blanket Implementations

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

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized

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

impl<T, U> Into<U> for T where
    U: From<T>, 

impl<T> ToOwned for T where
    T: Clone

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

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

The type returned in the event of a conversion error.