Types
Option[T] = object val: T has: bool
- An optional type that stores its value and state separately in a boolean.
Procs
proc some[T](val: T): Option[T] {...}{.inline.}
- Returns a Option that has this value.
proc none(T: typedesc): Option[T] {...}{.inline.}
- Returns a Option for this type that has no value.
proc isSome[T](self: Option[T]): bool {...}{.inline.}
proc isNone[T](self: Option[T]): bool {...}{.inline.}
proc get[T](self: Option[T]): T {...}{.inline.}
- Returns contents of the Option. If it is none, then an exception is thrown.
proc get[T](self: Option[T]; otherwise: T): T {...}{.inline.}
- Returns the contents of this option or otherwise if the option is none.
proc `==`(a, b: Option): bool {...}{.inline.}
- Returns true if both Option``s are ``none, or if they have equal values
proc `$`[T](self: Option[T]): string {...}{.inline.}
- Returns the contents of this option or otherwise if the option is none.