Splices the steps of validator into restriction, so two independently
defined validators combine into one. Splicing happens when the validator is
built: print() shows one flat list of steps and there is no nesting at
run time.
Details
If validator allows NULL (see allow_null()), its steps are
skipped for a NULL value and the combined validator does not itself
become NULL-tolerant.
See also
Other composition:
allow_null(),
require_any(),
require_col(),
require_each(),
require_fields()
Examples
id_v <- restrict("id") |> require_integer(no_na = TRUE)
pos_v <- restrict("x") |> require_positive(strict = TRUE)
restrict("id") |> require_valid(id_v) |> require_valid(pos_v)
#> <restriction id>
#> 1. must be whole number (no NA)
#> 2. must be positive