Struct krates::Cmd

source ·
pub struct Cmd { /* private fields */ }
Expand description

An alternative to cargo_metadata::MetadataCommand which allows correct feature usage, as well as ensuring that the command can run successfully regardless of where it is executed and on what.

Implementations§

source§

impl Cmd

source

pub fn new() -> Self

source

pub fn cargo_path(&mut self, path: impl Into<PathBuf>) -> &mut Self

Path to cargo executable. If not set, this will use the the $CARGO environment variable, and if that is not set, will simply be cargo.

source

pub fn manifest_path(&mut self, path: impl Into<PathBuf>) -> &mut Self

Path to a Cargo.toml manifest

source

pub fn current_dir(&mut self, path: impl Into<PathBuf>) -> &mut Self

Current directory of the cargo metadata process.

source

pub fn no_default_features(&mut self) -> &mut Self

Disables default features.

NOTE: This has no effect if used on a workspace. You must specify a working directory or manifest path to a specific crate if used on a crate inside a workspace.

source

pub fn all_features(&mut self) -> &mut Self

Enables all features for all workspace crates. Usable on both individual crates and on an entire workspace.

source

pub fn features(&mut self, feats: impl IntoIterator<Item = String>) -> &mut Self

Enables specific features. See the NOTE for no_default_features

source

pub fn lock_opts(&mut self, lopts: LockOptions) -> &mut Self

Sets the various lock options for determining if cargo can access the network and if the lockfile must be present and can be modified

source

pub fn other_options( &mut self, options: impl IntoIterator<Item = String> ) -> &mut Self

Arbitrary command line flags to pass to cargo. These will be added to the end of the command line invocation.

Trait Implementations§

source§

impl Debug for Cmd

source§

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

Formats the value using the given formatter. Read more
source§

impl Default for Cmd

source§

fn default() -> Cmd

Returns the “default value” for a type. Read more
source§

impl From<Cmd> for MetadataCommand

source§

fn from(cmd: Cmd) -> MetadataCommand

Converts to this type from the input type.

Auto Trait Implementations§

§

impl Freeze for Cmd

§

impl RefUnwindSafe for Cmd

§

impl Send for Cmd

§

impl Sync for Cmd

§

impl Unpin for Cmd

§

impl UnwindSafe for Cmd

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, U> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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.