in src/py_serde.cpp [29:53]
void init_serde(nb::module_& m) {
using namespace datasketches;
nb::class_<py_object_serde, PyObjectSerDe /* <--- trampoline*/>(m, "PyObjectSerDe",
"An abstract base class for serde objects. All custom serdes must extend this class.")
.def(nb::init<>())
.def("get_size", &py_object_serde::get_size, nb::arg("item"),
"Returns the size in bytes of an item\n\n"
":param item: The specified object\n:type item: object\n"
":return: The size of the item in bytes\n:rtype: int"
)
.def("to_bytes", &py_object_serde::to_bytes, nb::arg("item"),
"Retuns a bytes object with a serialized version of an item\n\n"
":param item: The specified object\n:type item: object\n"
":return: A :class:`bytes` object with the serialized object\n:rtype: bytes"
)
.def("from_bytes", &py_object_serde::from_bytes, nb::arg("data"), nb::arg("offset"),
"Reads a bytes object starting from the given offest and returns a tuple of the reconstructed "
"object and the number of additional bytes read\n\n"
":param data: A :class:`bytes` object from which to deserialize\n:type data: bytes\n"
":param offset: The offset, in bytes, at which to start reading\n:type offset: int\n"
":return: A :class:`tuple` with the reconstructed object and the number of bytes read\n"
":rtype: tuple(object, int)"
)
;
}