is.ok {matchr}R Documentation

Check if Result is Ok

Description

Test whether Result Enum is Ok or an Err.

Usage

is.ok(x)

Arguments

x

object to be tested

Value

TRUE if x is enumerated type of variant Ok, FALSE otherwise

Examples

sqrt_big <- function(x) {
  if (x > 1000){ return(Ok(sqrt(x))) }
  Err("Not large enough!")
}
x <- sqrt_big(250)
is.ok(x)  # FALSE


[Package matchr version 0.1.0 Index]