OptValue
Mojo struct 🡭
OptValue
@memory_only
struct OptValueWhen 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.
Aliases
__del__is_trivial = False__moveinit__is_trivial = False__copyinit__is_trivial = False
Fields
- kind (
OptKind)
Implemented traits
AnyType, Copyable, 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: Float64 = 0)
Details
Args:
- float_value (
Float64) - 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[Float64]
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
Args:OptKind.
- kind (
OptKind) - value (
String)
Returns:
Self
Raises: