Title: | Extension to R Serialization |
---|---|
Description: | Exposes the 'refhook' functionality of R serialization for alternative serialization of non-system reference objects. |
Authors: | Charlie Gao [aut, cre] , Hibiki AI Limited [cph] |
Maintainer: | Charlie Gao <[email protected]> |
License: | GPL (>= 3) |
Version: | 0.0.1.9000 |
Built: | 2025-01-03 10:20:17 UTC |
Source: | https://github.com/shikokuchuo/sakura |
Exposes the 'refhook' functionality of R serialization for alternative serialization of non-system reference objects.
Charlie Gao [email protected] (ORCID)
Useful links:
Report bugs at https://github.com/shikokuchuo/sakura/issues
Returns a serialization configuration for custom serialization and unserialization of non-system reference objects, using the 'refhook' system of R native serialization. This allows their use across different R sessions.
serial_config(class, sfunc, ufunc, vec = FALSE)
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 ‘class’ (or a list of such objects) and returns a raw vector. |
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 FALSE, they should accept and return reference objects
individually e.g. |
A pairlist comprising the configuration. This may be provided to the
'hook' argument of serialize
and unserialize
.
serial_config("test_class", base::serialize, base::unserialize)
serial_config("test_class", base::serialize, base::unserialize)
An extension of R native serialization using the 'refhook' system for custom serialization and unserialization of non-system reference objects.
serialize(x, hook = NULL) unserialize(x, hook = NULL)
serialize(x, hook = NULL) unserialize(x, hook = NULL)
x |
an object. |
hook |
[default NULL] optionally, a configuration returned by
|
For serialize: a raw vector. For unserialize: the unserialized object.
vec <- serialize(data.frame()) vec unserialize(vec)
vec <- serialize(data.frame()) vec unserialize(vec)