[][src]Struct auditable_serde::VersionInfo

pub struct VersionInfo {
    pub packages: Vec<Package>,
}

Dependency tree embedded in the binary.

Implements Serialize and Deserialize traits from serde, so you can use all the usual methods from serde-json to read and write it.

from_str() that parses JSON is also implemented for your convenience:

use auditable_serde::VersionInfo;
use std::str::FromStr;
let json_str = r#"{"packages":[{
    "name":"adler",
    "version":"0.2.3",
    "source":"registry"
}]}"#;
let info = VersionInfo::from_str(json_str).unwrap();
assert_eq!(&info.packages[0].name, "adler");

Optional features

If the from_metadata feature is enabled, a conversion from cargo_metadata::Metadata is possible via the TryFrom trait. This is the preferred way to construct this structure. An example demonstrating that can be found here.

If the toml feature is enabled, a conversion into the cargo_lock::Lockfile struct is possible via the TryFrom trait. This can be useful if you need to interoperate with tooling that consumes the Cargo.lock file format. An example demonstrating it can be found here.

Fields

packages: Vec<Package>

Trait Implementations

impl Clone for VersionInfo[src]

impl Debug for VersionInfo[src]

impl<'de> Deserialize<'de> for VersionInfo[src]

impl Eq for VersionInfo[src]

impl FromStr for VersionInfo[src]

type Err = Error

The associated error which can be returned from parsing.

impl Ord for VersionInfo[src]

impl PartialEq<VersionInfo> for VersionInfo[src]

impl PartialOrd<VersionInfo> for VersionInfo[src]

impl Serialize for VersionInfo[src]

impl StructuralEq for VersionInfo[src]

impl StructuralPartialEq for VersionInfo[src]

impl<'_> TryFrom<&'_ Metadata> for VersionInfo[src]

type Error = InsufficientMetadata

The type returned in the event of a conversion error.

impl<'_> TryFrom<&'_ VersionInfo> for Lockfile[src]

type Error = Error

The type returned in the event of a conversion error.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

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

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.