-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introducing FutureResult for returning richer sets of information fro…
- Loading branch information
1 parent
a16343c
commit f8a9afe
Showing
15 changed files
with
288 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#' Results from resolving a future | ||
#' | ||
#' @param value The value of the future expression. | ||
#' If the expression was not fully resolved (e.g. an error) occurred, | ||
#' the the value is `NULL`. | ||
#' | ||
#' @param condition A [[base::condition]] captured while resolving the future, | ||
#' if any. This is typically an error. | ||
#' | ||
#' @param \ldots (optional) Additional named results to be returned. | ||
#' | ||
#' @param version The version format of the results. | ||
#' | ||
#' @return An object of class FutureResult. | ||
#' | ||
#' @details | ||
#' This function is only part of the _backend_ Future API. | ||
#' This function is _not_ part of the frontend Future API. | ||
#' | ||
#' @export | ||
#' @keywords internal | ||
FutureResult <- function(value = NULL, condition = NULL, ..., version = "1.7") { | ||
args <- list(...) | ||
if (length(args) > 0) { | ||
names <- names(args) | ||
if (is.null(names) || any(nchar(names) == 0)) { | ||
stop(FutureError("Internal error: All arguments to FutureResult() must be named")) | ||
} | ||
} | ||
|
||
structure(list(value = value, condition = condition, ..., version = version), | ||
class = c("FutureResult", "list")) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.