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_readme(&self) -> Option<String>
pub fn crate_readme(&self) -> Option<String>
Gets the optional path to the readme, or None if disabled.
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
Auto Trait Implementations§
impl Freeze for CrateData
impl RefUnwindSafe for CrateData
impl Send for CrateData
impl Sync for CrateData
impl Unpin for CrateData
impl UnwindSafe for CrateData
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
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>
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>
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