The coroutine format method displays its source code, its effective environment, whether it is running or finished, and a label indicating its last known state. The summary method returns the same information in a list.

summary(obj) returns a list with information on a coroutine's state, including:

  • code: the expression used to create the coroutine;

  • state: the current state (see below);

  • node: is a character string that identifies a location in the coroutine source code; for example, a typical state string might be ".{.<-2.await__then", which can be read like "in the first argument of \{, in the second argument of <-, in a call to await(), at internal node then.";

  • envir: the environment where the coroutine is evaluating R expressions;

  • err: the error object, if the coroutine caught an error.

summary(g)$state for a generator g might be "yielded", "running" (if nextElem is currently being called,) "stopped" (for generators that have stopped with an error,) or "finished" (for generators that have finished normally.)

summary(a)$state of an async might be "pending", "resolved" or "rejected".

summary(s)$state on a stream might be "resolved", "rejected", "running", "woken", "yielding", or "yielded".

# S3 method for coroutine
format(x, ...)

# S3 method for coroutine
summary(object, ...)

# S3 method for generator
summary(object, ...)

# S3 method for async
summary(object, ...)

# S3 method for stream
summary(object, ...)



A coroutine.




a coroutine (async, generator, or stream) object.