Struct cargo_metadata::Package[][src]

pub struct Package {
    pub name: String,
    pub version: String,
    pub id: String,
    pub dependencies: Vec<Dependency>,
    pub targets: Vec<Target>,
    pub features: HashMap<String, Vec<String>>,
    pub manifest_path: String,
    pub metadata: Value,
    // some fields omitted
}

A crate

Fields

Name as given in the Cargo.toml

Version given in the Cargo.toml

An opaque identifier for a package

List of dependencies of this particular package

Targets provided by the crate (lib, bin, example, test, ...)

Features provided by the crate, mapped to the features required by that feature.

Path containing the Cargo.toml

Contents of the free form package.metadata section

This contents can be serialized to a struct using serde:

#[macro_use]
extern crate serde_json;
#[macro_use]
extern crate serde_derive;

#[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);
}

Trait Implementations

impl Clone for Package
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Debug for Package
[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl Send for Package

impl Sync for Package