Struct Package

Source
pub struct Package<Metadata = Value> {
Show 28 fields pub name: String, pub edition: Option<MaybeInherited<Edition>>, pub version: Option<MaybeInherited<String>>, pub build: Option<StringOrBool>, pub workspace: Option<String>, pub authors: Option<MaybeInherited<Vec<String>>>, pub links: Option<String>, pub description: Option<MaybeInherited<String>>, pub homepage: Option<MaybeInherited<String>>, pub documentation: Option<MaybeInherited<String>>, pub readme: Option<MaybeInherited<StringOrBool>>, pub keywords: Option<MaybeInherited<Vec<String>>>, pub categories: Option<MaybeInherited<Vec<String>>>, pub license: Option<MaybeInherited<String>>, pub license_file: Option<MaybeInherited<String>>, pub repository: Option<MaybeInherited<String>>, pub metadata: Option<Metadata>, pub rust_version: Option<MaybeInherited<String>>, pub exclude: Option<MaybeInherited<Vec<String>>>, pub include: Option<MaybeInherited<Vec<String>>>, pub default_run: Option<String>, pub autolib: Option<bool>, pub autobins: Option<bool>, pub autoexamples: Option<bool>, pub autotests: Option<bool>, pub autobenches: Option<bool>, pub publish: Option<MaybeInherited<Publish>>, pub resolver: Option<Resolver>,
}
Expand description

You can replace Metadata type with your own to parse into something more useful than a generic toml Value

Fields§

§name: String

Careful: some names are uppercase

§edition: Option<MaybeInherited<Edition>>§version: Option<MaybeInherited<String>>

The version of the package (e.g. “1.9.0”).

Use Package::version() to get the effective value, with the default value of “0.0.0” applied.

§build: Option<StringOrBool>§workspace: Option<String>§authors: Option<MaybeInherited<Vec<String>>>

e.g. [“Author e@mail”, “etc”]

§links: Option<String>§description: Option<MaybeInherited<String>>

A short blurb about the package. This is not rendered in any format when uploaded to crates.io (aka this is not markdown).

§homepage: Option<MaybeInherited<String>>§documentation: Option<MaybeInherited<String>>§readme: Option<MaybeInherited<StringOrBool>>

This points to a file under the package root (relative to this Cargo.toml).

§keywords: Option<MaybeInherited<Vec<String>>>§categories: Option<MaybeInherited<Vec<String>>>

This is a list of up to five categories where this crate would fit. e.g. [“command-line-utilities”, “development-tools::cargo-plugins”]

§license: Option<MaybeInherited<String>>

e.g. “MIT”

§license_file: Option<MaybeInherited<String>>§repository: Option<MaybeInherited<String>>§metadata: Option<Metadata>§rust_version: Option<MaybeInherited<String>>

e.g. “1.63.0”

§exclude: Option<MaybeInherited<Vec<String>>>§include: Option<MaybeInherited<Vec<String>>>§default_run: Option<String>

The default binary to run by cargo run.

§autolib: Option<bool>

Disables library auto discovery.

§autobins: Option<bool>

Disables binary auto discovery.

Use Manifest::autobins() to get the effective value.

§autoexamples: Option<bool>

Disables example auto discovery.

Use Manifest::autoexamples() to get the effective value.

§autotests: Option<bool>

Disables test auto discovery.

Use Manifest::autotests() to get the effective value.

§autobenches: Option<bool>

Disables bench auto discovery.

Use Manifest::autobenches() to get the effective value.

§publish: Option<MaybeInherited<Publish>>§resolver: Option<Resolver>

Implementations§

Source§

impl<Metadata> Package<Metadata>

Source

pub fn new(name: String, version: String) -> Self

Source

pub fn version(&self) -> MaybeInherited<&str>

Returns the effective version of the package.

If the version is not set, it defaults to “0.0.0” (see https://doc.rust-lang.org/cargo/reference/manifest.html#the-version-field).

Trait Implementations§

Source§

impl<Metadata: Clone> Clone for Package<Metadata>

Source§

fn clone(&self) -> Package<Metadata>

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<Metadata: Debug> Debug for Package<Metadata>

Source§

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

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

impl<'de, Metadata> Deserialize<'de> for Package<Metadata>
where Metadata: Deserialize<'de>,

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<Metadata: PartialEq> PartialEq for Package<Metadata>

Source§

fn eq(&self, other: &Package<Metadata>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<Metadata> Serialize for Package<Metadata>
where Metadata: Serialize,

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<Metadata> StructuralPartialEq for Package<Metadata>

Auto Trait Implementations§

§

impl<Metadata> Freeze for Package<Metadata>
where Metadata: Freeze,

§

impl<Metadata> RefUnwindSafe for Package<Metadata>
where Metadata: RefUnwindSafe,

§

impl<Metadata> Send for Package<Metadata>
where Metadata: Send,

§

impl<Metadata> Sync for Package<Metadata>
where Metadata: Sync,

§

impl<Metadata> Unpin for Package<Metadata>
where Metadata: Unpin,

§

impl<Metadata> UnwindSafe for Package<Metadata>
where Metadata: UnwindSafe,

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

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

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

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