Struct cargo_temp::Cli [−][src]
pub struct Cli {
pub dependencies: Vec<Dependency>,
pub lib: bool,
pub project_name: Option<String>,
pub worktree_branch: Option<Option<String>>,
pub git: Option<String>,
}
Expand description
This tool allow you to create a new Rust temporary project in a temporary directory.
The dependencies can be provided in arguments (e.g.cargo-temp anyhow tokio
). When the shell is exited, the temporary directory is deleted unless
you removed the file TO_DELETE
.
Fields
dependencies: Vec<Dependency>
Dependencies to add to Cargo.toml
.
The default version used is *
but this can be replaced using =
.
E.g. cargo-temp anyhow=1.0.13
lib: bool
Create a library instead of a binary.
project_name: Option<String>
Name of the temporary crate.
worktree_branch: Option<Option<String>>
Create a temporary Git working tree based on the repository in the current directory.
git: Option<String>
Create a temporary clone of a Git repository.
Implementations
Trait Implementations
fn parse_from<I, T>(itr: I) -> Self where
T: Into<OsString> + Clone,
I: IntoIterator<Item = T>,
fn parse_from<I, T>(itr: I) -> Self where
T: Into<OsString> + Clone,
I: IntoIterator<Item = T>,
Parse from iterator, exit on error
fn try_parse_from<I, T>(itr: I) -> Result<Self, Error> where
T: Into<OsString> + Clone,
I: IntoIterator<Item = T>,
fn try_parse_from<I, T>(itr: I) -> Result<Self, Error> where
T: Into<OsString> + Clone,
I: IntoIterator<Item = T>,
Parse from iterator, return Err on error.
It’s common to have an “application context” struct (sometimes called config) that represents all the normalized values after being processed by the CLI. Read more