[]Struct ra_ap_ide::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.

Implementations

impl CrateGraph

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 + 'static>), Global>
) -> CrateId

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

pub fn is_empty(&self) -> bool

pub fn iter(&self) -> impl Iterator<Item = CrateId>

pub fn transitive_deps(&self, of: CrateId) -> impl Iterator<Item = CrateId>

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

pub fn crates_in_topological_order(&self) -> Vec<CrateId, Global>

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>

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

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

Trait Implementations

impl Clone for CrateGraph

impl Debug for CrateGraph

impl Default for CrateGraph

impl Eq for CrateGraph

impl Index<CrateId> for CrateGraph

type Output = CrateData

The returned type after indexing.

impl PartialEq<CrateGraph> for CrateGraph

impl StructuralEq for CrateGraph

impl StructuralPartialEq for CrateGraph

Auto Trait Implementations

Blanket Implementations

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

impl<T> Any for T where
    T: Any

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

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

impl<T> Cast for T

impl<T> CloneAny for T where
    T: Clone + Any

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

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

impl<T> Instrument for T[src]

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

impl<T> Pointable for T

type Init = T

The type for initializers.

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.