unwrap method

T unwrap()

Returns the held value of this Option if it is Some.

Warning: This method is unsafe. An OptionError will be thrown when this method is called if this Option is None.

See also: Rust: Option::unwrap()

Implementation

T unwrap() {
  return switch (this) {
    Some(:T v) => v,
    None() => throw OptionError('called `Option#unwrap()` on a `None` value'),
  };
}