Skip to contents

[Stable]

The Result class wraps a value in order to provide context to the value. Namely, that the value is the result of a successful computation. i.e. a function finished without an issue or error.

Usage

Success(value = NULL)

Arguments

value

The object to wrap - typically the result that would be returned by of one of your functions.

Value

A Success S7 object with its @value property set to the value that was passed in the constructor.

See also

Failure(), which wraps a value to provide the context of a failed computation.

Examples

Success(10)
#> <resultr::Success>
#>  @ value: num 10
Success(1:10)
#> <resultr::Success>
#>  @ value: int [1:10] 1 2 3 4 5 6 7 8 9 10
Success(TRUE)
#> <resultr::Success>
#>  @ value: logi TRUE
Success(data.frame(a = 1:10, b = 10:1))
#> <resultr::Success>
#>  @ value:'data.frame':	10 obs. of  2 variables:
#>  .. $ a: int  1 2 3 4 5 6 7 8 9 10
#>  .. $ b: int  10 9 8 7 6 5 4 3 2 1