Struct CrateGraphBuilder
pub struct CrateGraphBuilder { /* private fields */ }
Implementations§
§impl CrateGraphBuilder
impl CrateGraphBuilder
pub fn add_crate_root( &mut self, root_file_id: FileId, edition: Edition, display_name: Option<CrateDisplayName>, version: Option<String>, cfg_options: CfgOptions, potential_cfg_options: Option<CfgOptions>, env: Env, origin: CrateOrigin, is_proc_macro: bool, proc_macro_cwd: Arc<AbsPathBuf>, ws_data: Arc<CrateWorkspaceData>, ) -> Idx<CrateBuilder>
pub fn add_dep( &mut self, from: Idx<CrateBuilder>, dep: Dependency<Idx<CrateBuilder>>, ) -> Result<(), CyclicDependenciesError>
pub fn set_in_db( self, db: &mut (dyn RootQueryDb + 'static), ) -> HashMap<Idx<CrateBuilder>, Crate, FxBuildHasher>
pub fn iter(&self) -> impl Iterator<Item = Idx<CrateBuilder>>
pub fn transitive_deps(
&self,
of: Idx<CrateBuilder>,
) -> impl Iterator<Item = Idx<CrateBuilder>>
pub fn transitive_deps( &self, of: Idx<CrateBuilder>, ) -> impl Iterator<Item = Idx<CrateBuilder>>
Returns an iterator over all transitive dependencies of the given crate, including the crate itself.
pub fn extend(
&mut self,
other: CrateGraphBuilder,
proc_macros: &mut HashMap<Idx<CrateBuilder>, Result<(String, AbsPathBuf), String>, FxBuildHasher>,
) -> HashMap<Idx<CrateBuilder>, Idx<CrateBuilder>, FxBuildHasher>
pub fn extend( &mut self, other: CrateGraphBuilder, proc_macros: &mut HashMap<Idx<CrateBuilder>, Result<(String, AbsPathBuf), String>, FxBuildHasher>, ) -> HashMap<Idx<CrateBuilder>, Idx<CrateBuilder>, FxBuildHasher>
Extends this crate graph by adding a complete second crate
graph and adjust the ids in the [ProcMacroPaths
] accordingly.
This will deduplicate the crates of the graph where possible. Furthermore dependencies are sorted by crate id to make deduplication easier.
Returns a map mapping other
’s IDs to the new IDs in self
.
pub fn remove_crates_except(
&mut self,
to_keep: &[Idx<CrateBuilder>],
) -> Vec<Option<Idx<CrateBuilder>>>
pub fn remove_crates_except( &mut self, to_keep: &[Idx<CrateBuilder>], ) -> Vec<Option<Idx<CrateBuilder>>>
Removes all crates from this crate graph except for the ones in to_keep
and fixes up the dependencies.
Returns a mapping from old crate ids to new crate ids.
pub fn shrink_to_fit(&mut self)
Trait Implementations§
§impl Clone for CrateGraphBuilder
impl Clone for CrateGraphBuilder
§fn clone(&self) -> CrateGraphBuilder
fn clone(&self) -> CrateGraphBuilder
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read more§impl Debug for CrateGraphBuilder
impl Debug for CrateGraphBuilder
§impl Default for CrateGraphBuilder
impl Default for CrateGraphBuilder
§fn default() -> CrateGraphBuilder
fn default() -> CrateGraphBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for CrateGraphBuilder
impl RefUnwindSafe for CrateGraphBuilder
impl Send for CrateGraphBuilder
impl Sync for CrateGraphBuilder
impl Unpin for CrateGraphBuilder
impl UnwindSafe for CrateGraphBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Cast for T
impl<T> Cast for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more