CrateData

Struct CrateData 

Source
pub struct CrateData { /* private fields */ }
Expand description

Store for metadata learned about a crate

Implementations§

Source§

impl CrateData

Source

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.

Source

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.

Source

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.

Source

pub fn configured_profile(&self, profile: BuildProfile) -> &CargoWasmPackProfile

Get the configured profile.

Source

pub fn check_crate_config(&self) -> Result<()>

Check that the crate the given path is properly configured.

Source

pub fn crate_name(&self) -> String

Get the crate name for the crate at the given path.

Source

pub fn name_prefix(&self) -> String

Get the prefix for output file names

Source

pub fn crate_readme(&self) -> Option<String>

Gets the optional path to the readme, or None if disabled.

Source

pub fn crate_license(&self) -> &Option<String>

Get the license for the crate at the given path.

Source

pub fn crate_license_file(&self) -> Option<String>

Get the license file path for the crate at the given path.

Source

pub fn target_directory(&self) -> &Path

Returns the path to this project’s target directory where artifacts are located after a cargo build.

Source

pub fn workspace_root(&self) -> &Path

Returns the path to this project’s root cargo workspace directory

Source

pub fn write_package_json( &self, out_dir: &Path, scope: &Option<String>, disable_dts: bool, target: Target, ) -> Result<()>

Generate a package.json file inside in ./pkg.

Auto Trait Implementations§

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> 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.