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.
Fields
- kind (
OptKind)
Implemented traits
AnyType, Copyable, Deinitable, Movable
Methods
➕ ➖__init__
def __init__(out self, str_value: String = "")Details
Args:
- str_value (
String) - self (
Self)
Returns:
Self
def __init__(out self, int_value: Int = Int(0))Details
Args:
- int_value (
Int) - self (
Self)
Returns:
Self
def __init__(out self, float_value: Float64 = 0)Details
Args:
- float_value (
Float64) - self (
Self)
Returns:
Self
def __init__(out self, bool_value: Bool = False)Details
Args:
- bool_value (
Bool) - self (
Self)
Returns:
Self
get_string
def get_string(self) -> Optional[String]Details
Args:
- self (
Self)
Returns:
Optional[String]
get_int
def get_int(self) -> Optional[Int]Details
Args:
- self (
Self)
Returns:
Optional[Int]
get_float
def get_float(self) -> Optional[Float64]Details
Args:
- self (
Self)
Returns:
Optional[Float64]
get_bool
def get_bool(self) -> Optional[Bool]Details
Args:
- self (
Self)
Returns:
Optional[Bool]
parse_string
@staticmethod
def parse_string(value: String) -> SelfDetails
Args:
- value (
String)
Returns:
Self
parse_int
@staticmethod
def parse_int(value: String) -> SelfDetails
Args:
- value (
String)
Returns:
Self
Raises:
parse_float
@staticmethod
def parse_float(value: String) -> SelfDetails
Args:
- value (
String)
Returns:
Self
Raises:
parse_bool
@staticmethod
def parse_bool(value: String) -> SelfDetails
Args:
- value (
String)
Returns:
Self
Raises:
parse_kind
@staticmethod
def parse_kind(kind: OptKind, value: String) -> SelfParse the string based on the value of
Args:OptKind.
- kind (
OptKind) - value (
String)
Returns:
Self
Raises: