pub struct Package {Show 22 fields
pub name: String,
pub version: Version,
pub authors: Vec<String>,
pub id: PackageId,
pub source: Option<Source>,
pub description: Option<String>,
pub dependencies: Vec<Dependency>,
pub license: Option<String>,
pub license_file: Option<PathBuf>,
pub targets: Vec<Target>,
pub features: HashMap<String, Vec<String>>,
pub manifest_path: PathBuf,
pub categories: Vec<String>,
pub keywords: Vec<String>,
pub readme: Option<PathBuf>,
pub repository: Option<String>,
pub homepage: Option<String>,
pub documentation: Option<String>,
pub edition: String,
pub metadata: Value,
pub links: Option<String>,
pub publish: Option<Vec<String>>,
/* private fields */
}Expand description
One or more crates described by a single Cargo.toml
Each target of a Package will be built as a crate.
For more information, see https://doc.rust-lang.org/book/ch07-01-packages-and-crates.html.
Fields§
§name: StringName as given in the Cargo.toml
version: VersionVersion given in the Cargo.toml
Authors given in the Cargo.toml
id: PackageIdAn opaque identifier for a package
source: Option<Source>The source of the package, e.g.
crates.io or None for local projects.
description: Option<String>Description as given in the Cargo.toml
dependencies: Vec<Dependency>List of dependencies of this particular package
license: Option<String>License as given in the Cargo.toml
license_file: Option<PathBuf>If the package is using a nonstandard license, this key may be specified instead of
license, and must point to a file relative to the manifest.
targets: Vec<Target>Targets provided by the crate (lib, bin, example, test, …)
features: HashMap<String, Vec<String>>Features provided by the crate, mapped to the features required by that feature.
manifest_path: PathBufPath containing the Cargo.toml
categories: Vec<String>Categories as given in the Cargo.toml
keywords: Vec<String>Keywords as given in the Cargo.toml
readme: Option<PathBuf>Readme as given in the Cargo.toml
repository: Option<String>Repository as given in the Cargo.toml
homepage: Option<String>Homepage as given in the Cargo.toml
On versions of cargo before 1.49, this will always be None.
documentation: Option<String>Documentation URL as given in the Cargo.toml
On versions of cargo before 1.49, this will always be None.
edition: StringDefault Rust edition for the package
Beware that individual targets may specify their own edition in
Target::edition.
metadata: ValueContents of the free form package.metadata section
This contents can be serialized to a struct using serde:
use serde::Deserialize;
use serde_json::json;
#[derive(Debug, Deserialize)]
struct SomePackageMetadata {
some_value: i32,
}
fn main() {
let value = json!({
"some_value": 42,
});
let package_metadata: SomePackageMetadata = serde_json::from_value(value).unwrap();
assert_eq!(package_metadata.some_value, 42);
}
links: Option<String>The name of a native library the package is linking to.
publish: Option<Vec<String>>List of registries to which this package may be published.
Publishing is unrestricted if None, and forbidden if the Vec is empty.
This is always None if running with a version of Cargo older than 1.39.
Implementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Package
impl<'de> Deserialize<'de> for Package
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Package, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Package, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl PackageExt for Package
impl PackageExt for Package
Source§impl Serialize for Package
impl Serialize for Package
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Freeze for Package
impl RefUnwindSafe for Package
impl Send for Package
impl Sync for Package
impl Unpin for Package
impl UnwindSafe for Package
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.