pub struct VersionInfo {
pub packages: Vec<Package>,
pub format: u32,
}Expand description
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");If deserialization succeeds, it is guaranteed that there is only one root package, and that are no cyclic dependencies.
Fields§
§packages: Vec<Package>§format: u32Format revision. Identifies the data source for the audit data.
Format revisions are backwards compatible.
If an unknown format is encountered, it should be treated as the highest known preceding format.
For example, if formats 0, 1 and 8 are known, format 4 should be treated as if it’s 1.
§Known formats
§0 (or the field is absent)
Generated based on the data provided by cargo metadata.
There are multiple known issues with this data source, leading to the audit data sometimes including more dependencies than are really used in the build.
However, is the only machine-readable data source available on stable Rust as of v1.88.
Additionally, this format incorrectly includes procedural macros and their dependencies as runtime dependencies while in reality they are build-time dependencies.
§1
Same as 0, but correctly records proc-macros and their dependencies as build-time dependencies.
May still include slightly more dependencies than are actually used, especially in workspaces.
§8
Generated using Cargo’s SBOM precursor as the data source.
This data is highly accurate, but as of Rust v1.88 can only be generated using a nightly build of Cargo.
Trait Implementations§
Source§impl Clone for VersionInfo
impl Clone for VersionInfo
Source§fn clone(&self) -> VersionInfo
fn clone(&self) -> VersionInfo
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for VersionInfo
impl Debug for VersionInfo
Source§impl<'de> Deserialize<'de> for VersionInfo
impl<'de> Deserialize<'de> for VersionInfo
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl FromStr for VersionInfo
impl FromStr for VersionInfo
Source§impl JsonSchema for VersionInfo
impl JsonSchema for VersionInfo
Source§fn schema_name() -> String
fn schema_name() -> String
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref keyword. Read more