Skip to contents

A shared generic across the LLMR method packages, for objects that carry consumable state. LLMR defines the generic and an erroring default only; a method package (for example, an archive replayer) registers the concrete method that restores its state.

Usage

reset(x, ...)

Arguments

x

An object with resettable state.

...

Passed to methods.

Value

x, invisibly, with its state restored.

Examples

# A method restores the object's state, here a replay queue's position:
reset.toy_queue <- function(x, ...) {
  x$position <- 1L
  invisible(x)
}
q <- structure(list(items = c("a", "b", "c"), position = 3L), class = "toy_queue")
reset(q)$position