when_all: Deferred value for a set of deferred values

View source: R/when_all.R

when_allR Documentation

Deferred value for a set of deferred values

Description

Create a deferred value that is resolved when all listed deferred values are resolved. Note that the error of an input deferred value triggers the error when_all as well.

Usage

when_all(..., .list = list())

Arguments

...

Deferred values.

.list

More deferred values.

Details

async has auto-cancellation, so if one deferred value errors, the rest of them will be automatically cancelled.

Value

A deferred value, that is conditioned on all deferred values in ... and .list.

See Also

when_any(), when_some()

Examples


## Check that the contents of two URLs are the same
afun <- async(function() {
  u1 <- http_get("https://eu.httpbin.org")
  u2 <- http_get("https://eu.httpbin.org/get")
  when_all(u1, u2)$
    then(function(x) identical(x[[1]]$content, x[[2]]$content))
})
synchronise(afun())


gaborcsardi/async documentation built on Nov. 20, 2024, 4:51 p.m.