cargo_generate

Struct TemplatePath

Source
pub struct TemplatePath {
    pub auto_path: Option<String>,
    pub subfolder: Option<String>,
    pub test: bool,
    pub git: Option<String>,
    pub branch: Option<String>,
    pub tag: Option<String>,
    pub revision: Option<String>,
    pub path: Option<String>,
    pub favorite: Option<String>,
}

Fields§

§auto_path: Option<String>

Auto attempt to use as either --git or --favorite. If either is specified explicitly, use as subfolder.

§subfolder: Option<String>

Specifies the subfolder within the template repository to be used as the actual template.

§test: bool

Expand $CWD as a template, then run cargo test on the expansion (set $CARGO_GENERATE_TEST_CMD to override test command).

Any arguments given after the --test argument, will be used as arguments for the test command.

§git: Option<String>

Git repository to clone template from. Can be a URL (like https://github.com/rust-cli/cli-template), a path (relative or absolute), or an owner/repo abbreviated GitHub URL (like rust-cli/cli-template).

Note that cargo generate will first attempt to interpret the owner/repo form as a relative path and only try a GitHub URL if the local path doesn’t exist.

§branch: Option<String>

Branch to use when installing from git

§tag: Option<String>

Tag to use when installing from git

§revision: Option<String>

Git revision to use when installing from git (e.g. a commit hash)

§path: Option<String>

Local path to copy the template from. Can not be specified together with –git.

§favorite: Option<String>

Generate a favorite template as defined in the config. In case the favorite is undefined, use in place of the --git option, otherwise specifies the subfolder

Implementations§

Source§

impl TemplatePath

Source

pub fn any_path(&self) -> &str

§Panics

Will panic if no path to a template has been set at all, which is never if Clap is initialized properly.

Source

pub const fn git(&self) -> Option<&(impl AsRef<str> + '_)>

Source

pub const fn branch(&self) -> Option<&(impl AsRef<str> + '_)>

Source

pub const fn tag(&self) -> Option<&(impl AsRef<str> + '_)>

Source

pub const fn revision(&self) -> Option<&(impl AsRef<str> + '_)>

Source

pub const fn path(&self) -> Option<&(impl AsRef<str> + '_)>

Source

pub const fn favorite(&self) -> Option<&(impl AsRef<str> + '_)>

Source

pub const fn auto_path(&self) -> Option<&(impl AsRef<str> + '_)>

Source

pub const fn subfolder(&self) -> Option<&(impl AsRef<str> + '_)>

Trait Implementations§

Source§

impl Args for TemplatePath

Source§

fn group_id() -> Option<Id>

Report the ArgGroup::id for this set of arguments
Source§

fn augment_args<'b>(__clap_app: Command) -> Command

Append to Command so it can instantiate Self via FromArgMatches::from_arg_matches_mut Read more
Source§

fn augment_args_for_update<'b>(__clap_app: Command) -> Command

Append to Command so it can instantiate self via FromArgMatches::update_from_arg_matches_mut Read more
Source§

impl Clone for TemplatePath

Source§

fn clone(&self) -> TemplatePath

Returns a copy of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for TemplatePath

Source§

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

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

impl Default for TemplatePath

Source§

fn default() -> TemplatePath

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

impl FromArgMatches for TemplatePath

Source§

fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>

Instantiate Self from ArgMatches, parsing the arguments as needed. Read more
Source§

fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches, ) -> Result<Self, Error>

Instantiate Self from ArgMatches, parsing the arguments as needed. Read more
Source§

fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches, ) -> Result<(), Error>

Assign values from ArgMatches to self.
Source§

fn update_from_arg_matches_mut( &mut self, __clap_arg_matches: &mut ArgMatches, ) -> Result<(), Error>

Assign values from ArgMatches to self.

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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<T> Any for T
where T: Any,

Source§

impl<T> CloneAny for T
where T: Any + Clone,

Source§

impl<T> CloneAnySend for T
where T: Any + Send + Clone,

Source§

impl<T> CloneAnySendSync for T
where T: Any + Send + Sync + Clone,

Source§

impl<T> CloneAnySync for T
where T: Any + Sync + Clone,

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T