serial_config | R Documentation |
Returns a serialization configuration, which may be set on a Socket for
custom serialization and unserialization of non-system reference objects,
allowing these to be sent and received between different R sessions. This
utilises the 'refhook' system of R native serialization. Once set, the
functions apply to all send and receive operations performed in mode
"serial"
over the Socket or Context created from the Socket.
serial_config(class, sfunc, ufunc, vec = FALSE)
class |
character string of the class of object custom serialization functions are applied to, e.g. 'ArrowTabular' or 'torch_tensor'. |
sfunc |
a function that accepts a reference object inheriting from
|
ufunc |
a function that accepts a raw vector and returns a reference object (or list of such objects). |
vec |
[default FALSE] whether or not the serialization functions are
vectorized. If |
A list comprising the configuration. This should be set on a Socket
using opt<-()
with option name "serial"
.
cfg <- serial_config("test_cls", function(x) serialize(x, NULL), unserialize)
cfg
s <- socket()
opt(s, "serial") <- cfg
# provide an empty list to remove registered functions
opt(s, "serial") <- list()
close(s)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.