Struct cargo_toml::Product

source ·
pub struct Product {
    pub path: Option<String>,
    pub name: Option<String>,
    pub test: bool,
    pub doctest: bool,
    pub bench: bool,
    pub doc: bool,
    pub plugin: bool,
    pub proc_macro: bool,
    pub harness: bool,
    pub edition: Edition,
    pub crate_type: Vec<String>,
    pub required_features: Vec<String>,
}
Expand description

Cargo uses the term “target” for both “target platform” and “build target” (the thing to build), which makes it ambigous. Here Cargo’s bin/lib target is renamed to product.

Fields§

§path: Option<String>

This field points at where the crate is located, relative to the Cargo.toml.

§name: Option<String>

The name of a product is the name of the library or binary that will be generated. This is defaulted to the name of the package, with any dashes replaced with underscores. (Rust extern crate declarations reference this name; therefore the value must be a valid Rust identifier to be usable.)

§test: bool

A flag for enabling unit tests for this product. This is used by cargo test.

§doctest: bool

A flag for enabling documentation tests for this product. This is only relevant for libraries, it has no effect on other sections. This is used by cargo test.

§bench: bool

A flag for enabling benchmarks for this product. This is used by cargo bench.

§doc: bool

A flag for enabling documentation of this product. This is used by cargo doc.

§plugin: bool

If the product is meant to be a compiler plugin, this field must be set to true for Cargo to correctly compile it and make it available for all dependencies.

§proc_macro: bool

If the product is meant to be a “macros 1.1” procedural macro, this field must be set to true.

§harness: bool

If set to false, cargo test will omit the --test flag to rustc, which stops it from generating a test harness. This is useful when the binary being built manages the test runner itself.

§edition: Edition

If set then a product can be configured to use a different edition than the [package] is configured to use, perhaps only compiling a library with the 2018 edition or only compiling one unit test with the 2015 edition. By default all products are compiled with the edition specified in [package].

§crate_type: Vec<String>

The available options are “dylib”, “rlib”, “staticlib”, “cdylib”, and “proc-macro”.

§required_features: Vec<String>

The required-features field specifies which features the product needs in order to be built. If any of the required features are not selected, the product will be skipped. This is only relevant for the [[bin]], [[bench]], [[test]], and [[example]] sections, it has no effect on [lib].

Trait Implementations§

source§

impl Clone for Product

source§

fn clone(&self) -> Product

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 Product

source§

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

Formats the value using the given formatter. Read more
source§

impl Default for Product

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<'de> Deserialize<'de> for Product

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
    __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl PartialEq<Product> for Product

source§

fn eq(&self, other: &Product) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for Product

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where
    __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Eq for Product

source§

impl StructuralEq for Product

source§

impl StructuralPartialEq for Product

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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> ToOwned for Twhere
    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 Twhere
    U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere
    U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

impl<T> DeserializeOwned for Twhere
    T: for<'de> Deserialize<'de>,