Struct Args

Source
pub struct Args {
    pub template_names: Vec<String>,
    pub server_url: String,
    pub generator_uri: String,
    pub lister_uri: String,
    pub show_help: bool,
    pub show_version: bool,
    pub show_author: bool,
    pub show_list: bool,
    pub check_template_names: bool,
    pub timeout: u64,
    pub timeout_unit: TimeoutUnit,
}
Expand description

Struct to gather cli args parsing result.

Used by crate::parser::ArgsParser implementations to store parsing result.

Fields§

§template_names: Vec<String>

A non-empty list of gitignore template names.

  • Represented by the provided positional arguments, and required unless any of author, version or help options are given.
  • This field does not allow commas in any of its field.
§server_url: String

The gitignore template generator service url.

§generator_uri: String

The gitignore template generator service endpoint uri.

§lister_uri: String

The gitignore template lister service endpoint uri.

§show_help: bool

The boolean indicator of whether to display help infos or not.

  • Optional value represented by the cli option crate::constant::cli_options::HELP, and falling back to false if not provided in cli args.
  • Has precedence over version and author options if multiple are given
§show_version: bool

The boolean indicator of whether to display version infos or not.

  • Optional value represented by the cli option crate::constant::cli_options::VERSION, and falling back to false if not provided in cli args.
  • Has precedence over author option if multiple are given
§show_author: bool

The boolean indicator of whether to display author infos or not.

§show_list: bool

The boolean indicator of whether to display list of available templates or not.

§check_template_names: bool

The boolean indicator of whether to enable robust template check or not.

Robust template check allow the script to handle template existence check without reaching the generator endpoint.

§timeout: u64

The service call timeout.

§timeout_unit: TimeoutUnit

The timeout unit.

Implementations§

Source§

impl Args

Source

pub fn new() -> Self

Source

pub fn with_template_names(self, template_names: Vec<String>) -> Self

Sets new value for template_names field.

It needs to be called on struct instance and effectively mutates it.

§Arguments
  • template_names - The new value to be assigned to template_names field.
§Returns

The mutated borrowed instance.

Source

pub fn with_server_url(self, server_url: &str) -> Self

Sets new value for server_url field.

It needs to be called on struct instance and effectively mutates it.

§Arguments
  • server_url - The new value to be assigned to server_url field.
§Returns

The mutated borrowed instance.

Source

pub fn with_generator_uri(self, generator_uri: &str) -> Self

Sets new value for generator_uri field.

It needs to be called on struct instance and effectively mutates it.

§Arguments
  • generator_uri - The new value to be assigned to generator_uri field.
§Returns

The mutated borrowed instance.

Source

pub fn with_lister_uri(self, lister_uri: &str) -> Self

Sets new value for lister_uri field.

It needs to be called on struct instance and effectively mutates it.

§Arguments
  • lister_uri - The new value to be assigned to lister_uri field.
§Returns

The mutated borrowed instance.

Source

pub fn with_show_list(self, show_list: bool) -> Self

Sets new value for show_list field.

It needs to be called on struct instance and effectively mutates it.

§Arguments
  • show_list - The new value to be assigned to show_list field.
§Returns

The mutated borrowed instance.

Source

pub fn with_check_template_names(self, check_template_names: bool) -> Self

Sets new value for check_template_names field.

It needs to be called on struct instance and effectively mutates it.

§Arguments
  • check_template_names - The new value to be assigned to check_template_names field.
§Returns

The mutated borrowed instance.

Source

pub fn with_timeout(self, timeout: u64) -> Self

Sets new value for timeout field.

It needs to be called on struct instance and effectively mutates it.

§Arguments
  • timeout - The new value to be assigned to timeout field.
§Returns

The mutated borrowed instance.

Source

pub fn with_timeout_unit(self, timeout_unit: TimeoutUnit) -> Self

Sets new value for timeout_unit field.

It needs to be called on struct instance and effectively mutates it.

§Arguments
  • timeout_unit - The new value to be assigned to timeout_unit field.
§Returns

The mutated borrowed instance.

Trait Implementations§

Source§

impl Debug for Args

Source§

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

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

impl Default for Args

Source§

fn default() -> Args

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

impl PartialEq for Args

Source§

fn eq(&self, other: &Args) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Args

Auto Trait Implementations§

§

impl Freeze for Args

§

impl RefUnwindSafe for Args

§

impl Send for Args

§

impl Sync for Args

§

impl Unpin for Args

§

impl UnwindSafe for Args

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

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.