cli
OptValue

OptValue

Mojo struct 🡭

OptValue

@memory_only
struct OptValue

When an option is parsed, it’s stored as an OptValue.

To get concrete values out of the ParsedOpts prefer to use the ParsedOpts.get_<type>() methods.

Fields

  • kind (OptKind)

Implemented traits

AnyType, Copyable, ExplicitlyCopyable, Movable, UnknownDestructibility

Methods

 

__init__

fn __init__(out self, str_value: String = "")

Details Args:

  • str_value (String)
  • self (Self)

Returns:

Self

fn __init__(out self, int_value: Int = 0)

Details Args:

  • int_value (Int)
  • self (Self)

Returns:

Self

fn __init__(out self, float_value: SIMD[float64, 1] = 0)

Details Args:

  • float_value (SIMD)
  • self (Self)

Returns:

Self

fn __init__(out self, bool_value: Bool = False)

Details Args:

  • bool_value (Bool)
  • self (Self)

Returns:

Self

get_string

fn get_string(self) -> Optional[String]

Details Args:

  • self (Self)

Returns:

Optional

get_int

fn get_int(self) -> Optional[Int]

Details Args:

  • self (Self)

Returns:

Optional

get_float

fn get_float(self) -> Optional[SIMD[float64, 1]]

Details Args:

  • self (Self)

Returns:

Optional

get_bool

fn get_bool(self) -> Optional[Bool]

Details Args:

  • self (Self)

Returns:

Optional

parse_string

@staticmethod
fn parse_string(value: String) -> Self

Details Args:

  • value (String)

Returns:

Self

parse_int

@staticmethod
fn parse_int(value: String) -> Self

Details Args:

  • value (String)

Returns:

Self

Raises:

parse_float

@staticmethod
fn parse_float(value: String) -> Self

Details Args:

  • value (String)

Returns:

Self

Raises:

parse_bool

@staticmethod
fn parse_bool(value: String) -> Self

Details Args:

  • value (String)

Returns:

Self

Raises:

parse_kind

@staticmethod
fn parse_kind(kind: OptKind, value: String) -> Self

Parse the string based on the value of OptKind. Args:

  • kind (OptKind)
  • value (String)

Returns:

Self

Raises: