Skip to main content

CrateManifest

Struct CrateManifest 

Source
pub struct CrateManifest {
    pub name: String,
    pub version: String,
    pub description: Option<String>,
    pub edition: String,
    pub dependencies: Vec<CrateDependency>,
    pub dev_dependencies: Vec<CrateDependency>,
    pub build_dependencies: Vec<CrateDependency>,
    pub workspace_member: bool,
}
Expand description

A parsed Cargo.toml manifest.

Fields§

§name: String

Crate name from [package].name

§version: String

Resolved version string (workspace inheritance resolved)

§description: Option<String>

Optional description from [package].description

§edition: String

Edition, e.g. "2024" (defaults to "2021" if missing)

§dependencies: Vec<CrateDependency>

Runtime dependencies from [dependencies]

§dev_dependencies: Vec<CrateDependency>

Dev-only dependencies from [dev-dependencies]

§build_dependencies: Vec<CrateDependency>

Build-script dependencies from [build-dependencies]

§workspace_member: bool

True when the crate is listed in [workspace].members

Implementations§

Source§

impl CrateManifest

Source

pub fn from_path(cargo_toml: &Path) -> Result<Self, String>

Parse a single Cargo.toml at cargo_toml.

If the package version uses workspace inheritance (version.workspace = true), we look for the workspace root at ../../../Cargo.toml (three levels up from crates/<name>/Cargo.toml). The caller can supply pre-parsed workspace deps by calling CrateManifest::from_path_with_workspace directly.

Source

pub fn from_path_with_workspace( cargo_toml: &Path, workspace_deps: &HashMap<String, String>, workspace_member: bool, ) -> Result<Self, String>

Parse a Cargo.toml with an explicit pre-parsed workspace dependency map.

workspace_member is set to the supplied value (the workspace root parser sets this after checking [workspace].members).

Source

pub fn all_dependencies(&self) -> impl Iterator<Item = &CrateDependency>

All dependencies (runtime + dev + build) as a flat iterator.

Trait Implementations§

Source§

impl Clone for CrateManifest

Source§

fn clone(&self) -> CrateManifest

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for CrateManifest

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

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

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Same for T

Source§

type Output = T

Should always be Self
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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more