Struct auditable_serde::VersionInfo
source · [−]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.
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
sourceimpl Clone for VersionInfo
impl Clone for VersionInfo
sourcefn clone(&self) -> VersionInfo
fn clone(&self) -> VersionInfo
1.0.0 · sourceconst fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read moresourceimpl Debug for VersionInfo
impl Debug for VersionInfo
sourceimpl<'de> Deserialize<'de> for VersionInfo
impl<'de> Deserialize<'de> for VersionInfo
sourcefn 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>,
sourceimpl FromStr for VersionInfo
impl FromStr for VersionInfo
sourceimpl JsonSchema for VersionInfo
impl JsonSchema for VersionInfo
sourcefn schema_name() -> String
fn schema_name() -> String
sourcefn json_schema(gen: &mut SchemaGenerator) -> Schema
fn json_schema(gen: &mut SchemaGenerator) -> Schema
sourcefn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref
keyword. Read moresourceimpl Ord for VersionInfo
impl Ord for VersionInfo
sourcefn cmp(&self, other: &VersionInfo) -> Ordering
fn cmp(&self, other: &VersionInfo) -> Ordering
1.21.0 · sourceconst fn max(self, other: Self) -> Self
const fn max(self, other: Self) -> Self
1.21.0 · sourceconst fn min(self, other: Self) -> Self
const fn min(self, other: Self) -> Self
1.50.0 · sourceconst fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
const fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
sourceimpl PartialEq<VersionInfo> for VersionInfo
impl PartialEq<VersionInfo> for VersionInfo
sourcefn eq(&self, other: &VersionInfo) -> bool
fn eq(&self, other: &VersionInfo) -> bool
sourceimpl PartialOrd<VersionInfo> for VersionInfo
impl PartialOrd<VersionInfo> for VersionInfo
sourcefn partial_cmp(&self, other: &VersionInfo) -> Option<Ordering>
fn partial_cmp(&self, other: &VersionInfo) -> Option<Ordering>
1.0.0 · sourceconst fn le(&self, other: &Rhs) -> bool
const fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more