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
sourceimpl 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
sourceimpl Clone for CargoMetadata
impl Clone for CargoMetadata
sourcefn clone(&self) -> CargoMetadata
fn clone(&self) -> CargoMetadata
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 CargoMetadata
impl Debug for CargoMetadata
sourceimpl<'de> Deserialize<'de> for CargoMetadata
impl<'de> Deserialize<'de> for CargoMetadata
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 Serialize for CargoMetadata
impl Serialize for CargoMetadata
sourceimpl TryFrom<CargoMetadata> for PackageGraph
impl TryFrom<CargoMetadata> for PackageGraph
Auto Trait Implementations
impl RefUnwindSafe for CargoMetadata
impl Send for CargoMetadata
impl Sync for CargoMetadata
impl Unpin for CargoMetadata
impl UnwindSafe for CargoMetadata
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
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more