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
impl Cmd
pub fn new() -> Self
sourcepub fn cargo_path(&mut self, path: impl Into<PathBuf>) -> &mut Self
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
.
sourcepub fn manifest_path(&mut self, path: impl Into<PathBuf>) -> &mut Self
pub fn manifest_path(&mut self, path: impl Into<PathBuf>) -> &mut Self
Path to a Cargo.toml
manifest
sourcepub fn current_dir(&mut self, path: impl Into<PathBuf>) -> &mut Self
pub fn current_dir(&mut self, path: impl Into<PathBuf>) -> &mut Self
Current directory of the cargo metadata
process.
sourcepub fn no_default_features(&mut self) -> &mut Self
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.
sourcepub fn all_features(&mut self) -> &mut Self
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.
sourcepub fn features(&mut self, feats: impl IntoIterator<Item = String>) -> &mut Self
pub fn features(&mut self, feats: impl IntoIterator<Item = String>) -> &mut Self
Enables specific features. See the NOTE for no_default_features
sourcepub fn lock_opts(&mut self, lopts: LockOptions) -> &mut Self
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
sourcepub fn other_options(
&mut self,
options: impl IntoIterator<Item = String>
) -> &mut Self
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.