Ok Reference
Ok is a class that represents a successful result value. It is one of the two possible states of a Result.
Constructor
Section titled “Constructor”Creates a Result representing a successful value.
var result = Ok(100);Parameters
Section titled “Parameters”value(dyn!) - The success value to wrap
Methods
Section titled “Methods”Inherited
Section titled “Inherited”All methods are inherited from the Result class. See the Result reference for documentation.
Example
Section titled “Example”var success = Ok(42);
println(success.is_ok()); // trueprintln(success.unwrap()); // 42println(success.unwrap_or(0)); // 42
var doubled = success.map((x) -> x * 2);println(doubled.unwrap()); // 84