is.err {matchr}R Documentation

Check if Result is an Err

Description

Test whether Result Enum is Ok or an Err.

Usage

is.err(x)

Arguments

x

object to be tested

Value

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

Examples

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


[Package matchr version 0.1.0 Index]