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 duplicate 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§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more