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>
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>
impl<Metadata> Package<Metadata>
pub fn new(name: String, version: String) -> Self
Sourcepub fn version(&self) -> MaybeInherited<&str>
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).