Struct ra_ap_ide::CrateGraph [−]
pub struct CrateGraph { /* fields omitted */ }
Expand description
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 enabled
cfg
flags and the set of dependencies.
Note that, due to cfg’s, there might be several crates for a single FileId
!
For the purposes of analysis, 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
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<ProcMacro, Global>
) -> CrateId
pub fn add_dep(
&mut self,
from: CrateId,
name: CrateName,
to: CrateId
) -> Result<(), CyclicDependenciesError>
pub fn transitive_deps(&self, of: CrateId) -> 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, including the crate itself.
pub fn transitive_rev_deps(&self, of: CrateId) -> impl Iterator<Item = CrateId>
pub fn transitive_rev_deps(&self, of: CrateId) -> impl Iterator<Item = CrateId>
Returns all transitive reverse dependencies of the given crate, including the crate itself.
pub fn crates_in_topological_order(&self) -> Vec<CrateId, Global>
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
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 Clone for CrateGraph
pub fn clone(&self) -> CrateGraph
pub fn clone(&self) -> CrateGraph
Returns a copy of the value. Read more
Performs copy-assignment from source
. Read more
impl Debug for CrateGraph
impl Debug for CrateGraph
impl Default for CrateGraph
impl Default for CrateGraph
pub fn default() -> CrateGraph
pub fn default() -> CrateGraph
Returns the “default value” for a type. Read more
impl Index<CrateId> for CrateGraph
impl Index<CrateId> for CrateGraph
impl PartialEq<CrateGraph> for CrateGraph
impl PartialEq<CrateGraph> for CrateGraph
pub fn eq(&self, other: &CrateGraph) -> bool
pub fn eq(&self, other: &CrateGraph) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
pub fn ne(&self, other: &CrateGraph) -> bool
pub fn ne(&self, other: &CrateGraph) -> bool
This method tests for !=
.
impl Eq for CrateGraph
impl StructuralEq for CrateGraph
impl StructuralPartialEq for CrateGraph
Auto Trait Implementations
impl RefUnwindSafe for CrateGraph
impl Send for CrateGraph
impl Sync for CrateGraph
impl Unpin for CrateGraph
impl UnwindSafe for CrateGraph
Blanket Implementations
Mutably borrows from an owned value. Read more
fn cast<U>(self, interner: &<U as HasInterner>::Interner) -> U where
Self: CastTo<U>,
U: HasInterner,
fn cast<U>(self, interner: &<U as HasInterner>::Interner) -> U where
Self: CastTo<U>,
U: HasInterner,
Cast a value to type U
using CastTo
.
Compare self to key
and return true
if they are equal.
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
impl<T> Any for T where
T: Any,