pub enum ProjectWorkspace {
    Cargo {
        cargo: CargoWorkspace,
        build_scripts: WorkspaceBuildScripts,
        sysroot: Result<Sysroot, Option<String>>,
        rustc: Result<(CargoWorkspace, WorkspaceBuildScripts), Option<String>>,
        rustc_cfg: Vec<CfgFlag>,
        cfg_overrides: CfgOverrides,
        toolchain: Option<Version>,
        target_layout: Result<String, String>,
    },
    Json {
        project: ProjectJson,
        sysroot: Result<Sysroot, Option<String>>,
        rustc_cfg: Vec<CfgFlag>,
        toolchain: Option<Version>,
    },
    DetachedFiles {
        files: Vec<AbsPathBuf>,
        sysroot: Result<Sysroot, Option<String>>,
        rustc_cfg: Vec<CfgFlag>,
    },
}

Variants§

§

Cargo

Fields

§rustc_cfg: Vec<CfgFlag>

Holds cfg flags for the current target. We get those by running rustc --print cfg.

FIXME: make this a per-crate map, as, eg, build.rs might have a different target.

§cfg_overrides: CfgOverrides
§toolchain: Option<Version>
§target_layout: Result<String, String>

Project workspace was discovered by running cargo metadata and rustc --print sysroot.

§

Json

Fields

§project: ProjectJson
§rustc_cfg: Vec<CfgFlag>

Holds cfg flags for the current target. We get those by running rustc --print cfg.

§toolchain: Option<Version>

Project workspace was manually specified using a rust-project.json file.

§

DetachedFiles

Fields

§rustc_cfg: Vec<CfgFlag>

Holds cfg flags for the current target. We get those by running rustc --print cfg.

Project with a set of disjoint files, not belonging to any particular workspace. Backed by basic sysroot crates for basic completion and highlighting.

Implementations§

source§

impl ProjectWorkspace

source

pub fn load( manifest: ProjectManifest, config: &CargoConfig, progress: &dyn Fn(String) ) -> Result<ProjectWorkspace>

source

pub fn load_inline( project_json: ProjectJson, target: Option<&str>, extra_env: &FxHashMap<String, String>, toolchain: Option<Version> ) -> ProjectWorkspace

source

pub fn load_detached_files( detached_files: Vec<AbsPathBuf>, config: &CargoConfig ) -> Result<ProjectWorkspace>

source

pub fn run_build_scripts( &self, config: &CargoConfig, progress: &dyn Fn(String) ) -> Result<WorkspaceBuildScripts>

Runs the build scripts for this ProjectWorkspace.

source

pub fn run_all_build_scripts( workspaces: &[ProjectWorkspace], config: &CargoConfig, progress: &dyn Fn(String) ) -> Vec<Result<WorkspaceBuildScripts>>

Runs the build scripts for the given ProjectWorkspaces. Depending on the invocation strategy this may run a single build process for all project workspaces.

source

pub fn set_build_scripts(&mut self, bs: WorkspaceBuildScripts)

source

pub fn workspace_definition_path(&self) -> Option<&AbsPath>

source

pub fn find_sysroot_proc_macro_srv(&self) -> Result<AbsPathBuf>

source

pub fn to_roots(&self) -> Vec<PackageRoot>

Returns the roots for the current ProjectWorkspace The return type contains the path and whether or not the root is a member of the current workspace

source

pub fn n_packages(&self) -> usize

source

pub fn to_crate_graph( &self, load: &mut dyn FnMut(&AbsPath) -> Option<FileId>, extra_env: &FxHashMap<String, String> ) -> (CrateGraph, ProcMacroPaths)

source

pub fn eq_ignore_build_data(&self, other: &Self) -> bool

source

pub fn is_json(&self) -> bool

Returns true if the project workspace is Json.

Trait Implementations§

source§

impl Clone for ProjectWorkspace

source§

fn clone(&self) -> ProjectWorkspace

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for ProjectWorkspace

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

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

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoBox<dyn Any> for T
where T: Any,

source§

fn into_box(self) -> Box<dyn Any>

Convert self into the appropriate boxed form.
source§

impl<T> IntoBox<dyn Any + Send> for T
where T: Any + Send,

source§

fn into_box(self) -> Box<dyn Any + Send>

Convert self into the appropriate boxed form.
source§

impl<T> IntoBox<dyn Any + Sync + Send> for T
where T: Any + Send + Sync,

source§

fn into_box(self) -> Box<dyn Any + Sync + Send>

Convert self into the appropriate boxed form.
source§

impl<T> IntoBox<dyn CloneAny> for T
where T: CloneAny,

source§

fn into_box(self) -> Box<dyn CloneAny>

Convert self into the appropriate boxed form.
source§

impl<T> IntoBox<dyn CloneAny + Send> for T
where T: CloneAny + Send,

source§

fn into_box(self) -> Box<dyn CloneAny + Send>

Convert self into the appropriate boxed form.
source§

impl<T> IntoBox<dyn CloneAny + Sync + Send> for T
where T: CloneAny + Send + Sync,

source§

fn into_box(self) -> Box<dyn CloneAny + Sync + Send>

Convert self into the appropriate boxed form.
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

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