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");
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
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl 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>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl FromStr for VersionInfo
impl FromStr for VersionInfo
sourceimpl Ord for VersionInfo
impl Ord for VersionInfo
sourcefn cmp(&self, other: &VersionInfo) -> Ordering
fn cmp(&self, other: &VersionInfo) -> Ordering
1.21.0 · sourcefn max(self, other: Self) -> Self
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
1.21.0 · sourcefn min(self, other: Self) -> Self
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Self where
Self: PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Self where
Self: PartialOrd<Self>,
Restrict a value to a certain interval. Read more
sourceimpl PartialEq<VersionInfo> for VersionInfo
impl PartialEq<VersionInfo> for VersionInfo
sourcefn eq(&self, other: &VersionInfo) -> bool
fn eq(&self, other: &VersionInfo) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &VersionInfo) -> bool
fn ne(&self, other: &VersionInfo) -> bool
This method tests for !=
.
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>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl Serialize for VersionInfo
impl Serialize for VersionInfo
sourceimpl TryFrom<&Metadata> for VersionInfo
impl TryFrom<&Metadata> for VersionInfo
sourceimpl TryFrom<&VersionInfo> for Lockfile
impl TryFrom<&VersionInfo> for Lockfile
impl Eq for VersionInfo
impl StructuralEq for VersionInfo
impl StructuralPartialEq for VersionInfo
Auto Trait Implementations
impl RefUnwindSafe for VersionInfo
impl Send for VersionInfo
impl Sync for VersionInfo
impl Unpin for VersionInfo
impl UnwindSafe for VersionInfo
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more