Skip to main content

ProjectContext

Struct ProjectContext 

Source
pub struct ProjectContext {
    pub metadata: Metadata,
    pub cargo_config: Option<Table>,
    pub cargo_toml: Table,
    pub rustc_version: Option<RustcVersion>,
    pub host_triple: Option<String>,
    pub installed_linkers: InstalledLinkers,
    pub env_vars: EnvVars,
    pub os: Os,
}
Expand description

All project data gathered up front. Checks are pure functions over this.

Fields§

§metadata: Metadata

Output of cargo metadata for the project.

§cargo_config: Option<Table>

Parsed .cargo/config.toml, if present.

§cargo_toml: Table

Parsed workspace-root Cargo.toml.

§rustc_version: Option<RustcVersion>

Parsed rustc version, if it could be determined.

§host_triple: Option<String>

The host target triple reported by rustc -vV, e.g. aarch64-apple-darwin. None if it could not be parsed.

§installed_linkers: InstalledLinkers

Which fast linkers were found on PATH.

§env_vars: EnvVars

Build-relevant environment variables.

§os: Os

The operating system build-rx is running on.

Implementations§

Source§

impl ProjectContext

Source

pub fn gather(manifest_path: Option<&Path>) -> Result<Self>

Gather all project data.

manifest_path selects the project; None uses the current directory.

Source

pub fn project_name(&self) -> &str

Get the project name from metadata.

Source

pub fn is_workspace(&self) -> bool

Check if this is a workspace with multiple members.

Source

pub fn declared_msrv(&self) -> Option<(u32, u32)>

The project’s declared minimum supported Rust version (rust-version), as (major, minor), read from [package] or [workspace.package].

Returns None when no MSRV is declared.

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, 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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>,

Source§

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.