Skip to contents

Validator functions for error value types created by nanonext.

Usage

is_error_value(x)

is_nul_byte(x)

Arguments

x

an object.

Value

Logical value TRUE or FALSE.

Details

Is the object an error value generated by the package. All non-success integer return values are classed ‘errorValue’ to be distinguishable from integer message values. Includes error values returned after a timeout etc.

Is the object a nul byte.

Examples

s <- socket()
r <- recv_aio(s, timeout = 10)
call_aio(r)$data
#> 'errorValue' int 5 | Timed out
close(s)
r$data == 5L
#> [1] TRUE
is_error_value(r$data)
#> [1] TRUE
is_error_value(5L)
#> [1] FALSE

is_nul_byte(as.raw(0L))
#> [1] TRUE
is_nul_byte(raw(length = 1L))
#> [1] TRUE
is_nul_byte(writeBin("", con = raw()))
#> [1] TRUE
is_nul_byte(0L)
#> [1] FALSE
is_nul_byte(NULL)
#> [1] FALSE
is_nul_byte(NA)
#> [1] FALSE