Struct guppy::CargoMetadata
source · pub struct CargoMetadata(_);
Expand description
Deserialized Cargo metadata.
Returned by a MetadataCommand
or constructed from cargo metadata
JSON output.
This is an alternative entry point for constructing a PackageGraph
, to be used if the JSON
output of cargo metadata
is already available. To construct a PackageGraph
from an on-disk
Cargo workspace, use MetadataCommand
.
This struct implements serde::Serialize
and Deserialize
.
Implementations§
source§impl CargoMetadata
impl CargoMetadata
sourcepub fn parse_json(json: impl AsRef<str>) -> Result<Self, Error>
pub fn parse_json(json: impl AsRef<str>) -> Result<Self, Error>
Deserializes this JSON blob into a CargoMetadata
.
sourcepub fn serialize(&self, writer: &mut impl Write) -> Result<(), Error>
pub fn serialize(&self, writer: &mut impl Write) -> Result<(), Error>
Serializes this metadata into the given writer.
sourcepub fn build_graph(self) -> Result<PackageGraph, Error>
pub fn build_graph(self) -> Result<PackageGraph, Error>
Parses this metadata and builds a PackageGraph
from it.
Trait Implementations§
source§impl Clone for CargoMetadata
impl Clone for CargoMetadata
source§fn clone(&self) -> CargoMetadata
fn clone(&self) -> CargoMetadata
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for CargoMetadata
impl Debug for CargoMetadata
source§impl<'de> Deserialize<'de> for CargoMetadata
impl<'de> Deserialize<'de> for CargoMetadata
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>,
Deserialize this value from the given Serde deserializer. Read more