async_constant: Make a minimal deferred that resolves to the specified value

View source: R/constant.R

async_constantR Documentation

Make a minimal deferred that resolves to the specified value

Description

This is sometimes useful to start a deferred chain.

Usage

async_constant(value = NULL)

Arguments

value

The value to resolve to.

Details

Note that the evaluation of value is forced when the deferred value is created.

Value

A deferred value.

Examples

afun <- async(function() {
  async_constant(1/100)$
    then(function(x) delay(x))$
    then(function(x) print(x))
})
synchronise(afun())

r-lib/async documentation built on March 24, 2024, 6:20 p.m.