pub enum ProjectWorkspace {
Cargo {
cargo: CargoWorkspace,
build_scripts: WorkspaceBuildScripts,
sysroot: Option<Sysroot>,
rustc: Option<CargoWorkspace>,
rustc_cfg: Vec<CfgFlag>,
cfg_overrides: CfgOverrides,
},
Json {
project: ProjectJson,
sysroot: Option<Sysroot>,
rustc_cfg: Vec<CfgFlag>,
},
DetachedFiles {
files: Vec<AbsPathBuf>,
sysroot: Sysroot,
rustc_cfg: Vec<CfgFlag>,
},
}
Variants
Cargo
Fields
cargo: CargoWorkspace
build_scripts: WorkspaceBuildScripts
rustc: Option<CargoWorkspace>
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
Project workspace was discovered by running cargo metadata
and rustc --print sysroot
.
Json
Project workspace was manually specified using a rust-project.json
file.
DetachedFiles
Project with a set of disjoint files, not belonging to any particular workspace. Backed by basic sysroot crates for basic completion and highlighting.
Implementations
sourceimpl ProjectWorkspace
impl ProjectWorkspace
pub fn load(
manifest: ProjectManifest,
config: &CargoConfig,
progress: &dyn Fn(String)
) -> Result<ProjectWorkspace>
pub fn load_inline(
project_json: ProjectJson,
target: Option<&str>
) -> Result<ProjectWorkspace>
pub fn load_detached_files(
detached_files: Vec<AbsPathBuf>
) -> Result<ProjectWorkspace>
pub fn run_build_scripts(
&self,
config: &CargoConfig,
progress: &dyn Fn(String)
) -> Result<WorkspaceBuildScripts>
pub fn set_build_scripts(&mut self, bs: WorkspaceBuildScripts)
sourcepub fn to_roots(&self) -> Vec<PackageRoot>
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
pub fn n_packages(&self) -> usize
pub fn to_crate_graph(
&self,
dummy_replace: &FxHashMap<Box<str>, Box<[Box<str>]>>,
load_proc_macro: &mut dyn FnMut(&AbsPath, &[Box<str>]) -> Vec<ProcMacro>,
load: &mut dyn FnMut(&AbsPath) -> Option<FileId>
) -> CrateGraph
Trait Implementations
sourceimpl Clone for ProjectWorkspace
impl Clone for ProjectWorkspace
sourcefn clone(&self) -> ProjectWorkspace
fn clone(&self) -> ProjectWorkspace
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for ProjectWorkspace
impl Debug for ProjectWorkspace
sourceimpl PartialEq<ProjectWorkspace> for ProjectWorkspace
impl PartialEq<ProjectWorkspace> for ProjectWorkspace
sourcefn eq(&self, other: &ProjectWorkspace) -> bool
fn eq(&self, other: &ProjectWorkspace) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &ProjectWorkspace) -> bool
fn ne(&self, other: &ProjectWorkspace) -> bool
This method tests for !=
.
impl Eq for ProjectWorkspace
impl StructuralEq for ProjectWorkspace
impl StructuralPartialEq for ProjectWorkspace
Auto Trait Implementations
impl RefUnwindSafe for ProjectWorkspace
impl Send for ProjectWorkspace
impl Sync for ProjectWorkspace
impl Unpin for ProjectWorkspace
impl UnwindSafe for ProjectWorkspace
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more