endpoint_serializer: Endpoint Serializer with Hooks

View source: R/serializer.R

endpoint_serializerR Documentation

Endpoint Serializer with Hooks

Description

This method allows serializers to return preexec, postexec, and aroundexec (\lifecycleexperimental) hooks in addition to a serializer. This is useful for graphics device serializers which need a preexec and postexec hook to capture the graphics output.

Usage

endpoint_serializer(
  serializer,
  preexec_hook = NULL,
  postexec_hook = NULL,
  aroundexec_hook = NULL
)

Arguments

serializer

Serializer method to be used. This method should already have its initialization arguments applied.

preexec_hook

Function to be run directly before a PlumberEndpoint calls its route method.

postexec_hook

Function to be run directly after a PlumberEndpoint calls its route method.

aroundexec_hook

Function to be run around a PlumberEndpoint call. Must handle a .next argument to continue execution. \lifecycleexperimental

Details

preexec and postexec hooks happened directly before and after a route is executed. These hooks are specific to a single PlumberEndpoint's route calculation.

Examples

# The definition of `serializer_device` returns
# * a `serializer_content_type` serializer
# * `aroundexec` hook
print(serializer_device)

trestletech/plumber documentation built on March 16, 2024, 8:21 a.m.