Struct Project

Source
pub struct Project { /* private fields */ }
Expand description

Information about a Cargo project

Implementations§

Source§

impl Project

Source

pub fn query<P>(path: P) -> Result<Self, Error>
where P: AsRef<Path>,

Retrieves information about the Cargo project at the given path

path doesn’t need to be the directory that contains the Cargo.toml file; it can be any point within the Cargo project.

Source

pub fn path( &self, artifact: Artifact<'_>, profile: Profile, target: Option<&str>, host: &str, ) -> Result<PathBuf, Error>

Returns the path to a build artifact

§Inputs
  • artifact is the kind of build artifact: Bin (--bin), Example (--example), Lib (--lib)
  • profile is the compilation profile: Dev or Release (--release)
  • target is the specified compilation target (--target)
  • host is the triple of host – this is used as the compilation target when no target is specified and the project has no default build target
Source

pub fn name(&self) -> &str

Returns the name of the project (package.name)

Source

pub fn target(&self) -> Option<&str>

Returns the default compilation target

Source

pub fn toml(&self) -> &Path

Returns the path to the project’s Cargo.toml

Source

pub fn target_dir(&self) -> &Path

Returns the target directory path

This is where build artifacts are placed

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.