Struct Args

Source
pub struct Args {
    pub template_names: Vec<String>,
    pub server_url: String,
    pub endpoint_uri: String,
    pub show_help: bool,
    pub show_version: bool,
    pub show_author: bool,
}
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.

§endpoint_uri: String

The gitignore template generator 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.

Implementations§

Source§

impl Args

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_endpoint_uri(self, endpoint_uri: &str) -> Self

Sets new value for endpoint_uri field.

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

§Arguments
  • endpoint_uri - The new value to be assigned to endpoint_uri 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.