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>
impl Manifest<Value>
Sourcepub fn from_slice(cargo_toml_content: &[u8]) -> Result<Self, Error>
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§impl<Metadata: for<'a> Deserialize<'a>> Manifest<Metadata>
impl<Metadata: for<'a> Deserialize<'a>> Manifest<Metadata>
Sourcepub fn from_slice_with_metadata(
cargo_toml_content: &[u8],
) -> Result<Self, Error>
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.
Sourcepub fn from_path_with_metadata(
cargo_toml_path: impl AsRef<Path>,
) -> Result<Self, Error>
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
Sourcepub fn complete_from_path(&mut self, path: &Path) -> Result<(), Error>
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.
Sourcepub fn complete_from_abstract_filesystem<FS: AbstractFilesystem>(
&mut self,
fs: &FS,
) -> Result<(), Error>
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).