pub struct CrateData { /* private fields */ }
Expand description
Store for metadata learned about a crate
Implementations§
source§impl CrateData
impl CrateData
sourcepub fn new(crate_path: &Path, out_name: Option<String>) -> Result<CrateData>
pub fn new(crate_path: &Path, out_name: Option<String>) -> Result<CrateData>
Reads all metadata for the crate whose manifest is inside the directory
specified by path
.
sourcepub fn parse_crate_data(manifest_path: &Path) -> Result<ManifestAndUnsedKeys>
pub fn parse_crate_data(manifest_path: &Path) -> Result<ManifestAndUnsedKeys>
Read the manifest_path
file and deserializes it using the toml Deserializer.
Returns a Result containing ManifestAndUnsedKeys
which contains CargoManifest
and a BTreeSet<String>
containing the unused keys from the parsed file.
Errors
Will return Err if the file (manifest_path) couldn’t be read or
if deserialize to CargoManifest
fails.
sourcepub fn warn_for_unused_keys(manifest_and_keys: &ManifestAndUnsedKeys)
pub fn warn_for_unused_keys(manifest_and_keys: &ManifestAndUnsedKeys)
Iterating through all the passed unused_keys
and output
a warning for each unknown key.
sourcepub fn configured_profile(&self, profile: BuildProfile) -> &CargoWasmPackProfile
pub fn configured_profile(&self, profile: BuildProfile) -> &CargoWasmPackProfile
Get the configured profile.
sourcepub fn check_crate_config(&self) -> Result<()>
pub fn check_crate_config(&self) -> Result<()>
Check that the crate the given path is properly configured.
sourcepub fn crate_name(&self) -> String
pub fn crate_name(&self) -> String
Get the crate name for the crate at the given path.
sourcepub fn name_prefix(&self) -> String
pub fn name_prefix(&self) -> String
Get the prefix for output file names
sourcepub fn crate_license(&self) -> &Option<String>
pub fn crate_license(&self) -> &Option<String>
Get the license for the crate at the given path.
sourcepub fn crate_license_file(&self) -> Option<String>
pub fn crate_license_file(&self) -> Option<String>
Get the license file path for the crate at the given path.
sourcepub fn target_directory(&self) -> &Path
pub fn target_directory(&self) -> &Path
Returns the path to this project’s target directory where artifacts are located after a cargo build.
sourcepub fn workspace_root(&self) -> &Path
pub fn workspace_root(&self) -> &Path
Returns the path to this project’s root cargo workspace directory