Struct Manifest

Source
pub struct Manifest<PackageMetadata = Value, WorkspaceMetadata = Value> {
Show 16 fields pub package: Option<Package<PackageMetadata>>, pub cargo_features: Option<Vec<String>>, pub workspace: Option<Workspace<WorkspaceMetadata>>, pub dependencies: Option<DepsSet>, pub dev_dependencies: Option<DepsSet>, pub build_dependencies: Option<DepsSet>, pub target: Option<TargetDepsSet>, pub features: Option<FeatureSet>, pub bin: Vec<Product>, pub bench: Vec<Product>, pub test: Vec<Product>, pub example: Vec<Product>, pub patch: Option<PatchSet>, pub lib: Option<Product>, pub profile: Option<Profiles>, pub badges: Option<Badges>,
}
Expand description

The top-level Cargo.toml structure

The Metadata is a type for [package.metadata] table. You can replace it with your own struct type if you use the metadata and don’t want to use the catch-all Value type.

Fields§

§package: Option<Package<PackageMetadata>>§cargo_features: Option<Vec<String>>§workspace: Option<Workspace<WorkspaceMetadata>>§dependencies: Option<DepsSet>§dev_dependencies: Option<DepsSet>§build_dependencies: Option<DepsSet>§target: Option<TargetDepsSet>§features: Option<FeatureSet>§bin: Vec<Product>

Note that due to autobins feature this is not the complete list unless you run complete_from_path

§bench: Vec<Product>§test: Vec<Product>§example: Vec<Product>§patch: Option<PatchSet>§lib: Option<Product>

Note that due to autolibs feature this is not the complete list unless you run complete_from_path

§profile: Option<Profiles>§badges: Option<Badges>

Implementations§

Source§

impl Manifest<Value>

Source

pub fn from_slice(cargo_toml_content: &[u8]) -> Result<Self, Error>

Parse contents of a Cargo.toml file already loaded as a byte slice.

It does not call complete_from_path, so may be missing implicit data.

Source

pub fn from_path(cargo_toml_path: impl AsRef<Path>) -> Result<Self, Error>

Parse contents from a Cargo.toml file on disk.

Calls complete_from_path.

Source§

impl<Metadata: for<'a> Deserialize<'a>> Manifest<Metadata>

Source

pub fn from_slice_with_metadata( cargo_toml_content: &[u8], ) -> Result<Self, Error>

Parse Cargo.toml, and parse its [package.metadata] into a custom Serde-compatible type.

It does not call complete_from_path, so may be missing implicit data.

Source

pub fn from_path_with_metadata( cargo_toml_path: impl AsRef<Path>, ) -> Result<Self, Error>

Parse contents from Cargo.toml file on disk, with custom Serde-compatible metadata type.

Calls complete_from_path

Source

pub fn complete_from_path(&mut self, path: &Path) -> Result<(), Error>

Cargo.toml may not contain explicit information about [lib], [[bin]] and [package].build, which are inferred based on files on disk.

This scans the disk to make the data in the manifest as complete as possible.

Source

pub fn complete_from_abstract_filesystem<FS: AbstractFilesystem>( &mut self, fs: &FS, ) -> Result<(), Error>

Cargo.toml may not contain explicit information about [lib], [[bin]] and [package].build, which are inferred based on files on disk.

You can provide any implementation of directory scan, which doesn’t have to be reading straight from disk (might scan a tarball or a git repo, for example).

Source

pub fn autobins(&self) -> bool

Source

pub fn autoexamples(&self) -> bool

Source

pub fn autotests(&self) -> bool

Source

pub fn autobenches(&self) -> bool

Trait Implementations§

Source§

impl<PackageMetadata: Clone, WorkspaceMetadata: Clone> Clone for Manifest<PackageMetadata, WorkspaceMetadata>

Source§

fn clone(&self) -> Manifest<PackageMetadata, WorkspaceMetadata>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<PackageMetadata: Debug, WorkspaceMetadata: Debug> Debug for Manifest<PackageMetadata, WorkspaceMetadata>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<PackageMetadata, WorkspaceMetadata> Default for Manifest<PackageMetadata, WorkspaceMetadata>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de, PackageMetadata, WorkspaceMetadata> Deserialize<'de> for Manifest<PackageMetadata, WorkspaceMetadata>
where PackageMetadata: Deserialize<'de>, WorkspaceMetadata: Deserialize<'de>,

Source§

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 FromStr for Manifest<Value>

Source§

fn from_str(cargo_toml_content: &str) -> Result<Self, Self::Err>

Parse contents of a Cargo.toml file loaded as a string

Note: this is not a file name, but file’s content. See from_path.

It does not call complete_from_path, so may be missing implicit data.

Source§

type Err = Error

The associated error which can be returned from parsing.
Source§

impl<PackageMetadata: PartialEq, WorkspaceMetadata: PartialEq> PartialEq for Manifest<PackageMetadata, WorkspaceMetadata>

Source§

fn eq(&self, other: &Manifest<PackageMetadata, WorkspaceMetadata>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<PackageMetadata, WorkspaceMetadata> Serialize for Manifest<PackageMetadata, WorkspaceMetadata>
where PackageMetadata: Serialize, WorkspaceMetadata: Serialize,

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<PackageMetadata, WorkspaceMetadata> StructuralPartialEq for Manifest<PackageMetadata, WorkspaceMetadata>

Auto Trait Implementations§

§

impl<PackageMetadata, WorkspaceMetadata> Freeze for Manifest<PackageMetadata, WorkspaceMetadata>
where PackageMetadata: Freeze, WorkspaceMetadata: Freeze,

§

impl<PackageMetadata, WorkspaceMetadata> RefUnwindSafe for Manifest<PackageMetadata, WorkspaceMetadata>
where PackageMetadata: RefUnwindSafe, WorkspaceMetadata: RefUnwindSafe,

§

impl<PackageMetadata, WorkspaceMetadata> Send for Manifest<PackageMetadata, WorkspaceMetadata>
where PackageMetadata: Send, WorkspaceMetadata: Send,

§

impl<PackageMetadata, WorkspaceMetadata> Sync for Manifest<PackageMetadata, WorkspaceMetadata>
where PackageMetadata: Sync, WorkspaceMetadata: Sync,

§

impl<PackageMetadata, WorkspaceMetadata> Unpin for Manifest<PackageMetadata, WorkspaceMetadata>
where PackageMetadata: Unpin, WorkspaceMetadata: Unpin,

§

impl<PackageMetadata, WorkspaceMetadata> UnwindSafe for Manifest<PackageMetadata, WorkspaceMetadata>
where PackageMetadata: UnwindSafe, WorkspaceMetadata: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,