The scoped form of a contextmanager(). Evaluates ctx with cleanup tied to
this call, passes the value it returns to code, and cleans up when code
finishes, even if it errors.
Examples
local_tempdir := contextmanager %@% function() {
path <- tempfile()
dir.create(path)
teardown(unlink(path, recursive = TRUE))
path
}
with_context(local_tempdir(), function(d) dir.exists(d))
#> [1] TRUE