Struct guppy::CargoMetadata
source · pub struct CargoMetadata(/* private fields */);
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
source§impl Serialize for CargoMetadata
impl Serialize for CargoMetadata
source§impl TryFrom<CargoMetadata> for PackageGraph
impl TryFrom<CargoMetadata> for PackageGraph
Auto Trait Implementations§
impl Freeze for CargoMetadata
impl RefUnwindSafe for CargoMetadata
impl Send for CargoMetadata
impl Sync for CargoMetadata
impl Unpin for CargoMetadata
impl UnwindSafe for CargoMetadata
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)