Struct ra_ap_base_db::CrateGraph [−][src]
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.
CrateGraph
is !Serialize
by design, see
https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/dev/architecture.md#serialization
Implementations
pub fn add_crate_root(
&mut self,
file_id: FileId,
edition: Edition,
display_name: Option<CrateDisplayName>,
cfg_options: CfgOptions,
potential_cfg_options: CfgOptions,
env: Env,
proc_macro: Vec<ProcMacro>
) -> CrateId
pub fn add_dep(
&mut self,
from: CrateId,
name: CrateName,
to: CrateId
) -> Result<(), CyclicDependenciesError>
Returns an iterator over all transitive dependencies of the given crate, including the crate itself.
Returns all transitive reverse dependencies of the given crate, including the crate itself.
Returns all crates in the graph, sorted in topological order (ie. dependencies of a crate come before the crate itself).
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.
Trait Implementations
Returns the “default value” for a type. Read more
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