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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)