Crates.io | pyany-serde |
lib.rs | pyany-serde |
version | |
source | src |
created_at | 2025-02-01 05:07:36.469451 |
updated_at | 2025-02-03 23:38:52.051587 |
description | Serialization and deserialization for Python objects |
homepage | |
repository | |
max_upload_size | |
id | 1538166 |
Cargo.toml error: | TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
A Rust crate which defines a trait for serializing and deserializing Python objects. Because this trait does not have the 'py lifetime specifier, trait objects can be stored in Python classes (see DynPyAnySerde). This allows for the different PyAnySerde implementations to be created and bound in the Python interpreter. There are a variety of implementations provided for standard Python objects, and there is a PythonSerde abstract Python class which can be implemented and turned into a Box
The use case for this crate is demonstrated in rlgym-learn - the user writes Python code which instantiates a struct defining Rust serialization and deserialization strategies (the PyAnySerde trait object, held inside a DynPyAnySerde) for a given generic type. In Rust, these DynPyAnySerdes can be received as function parameters and used via the append_python
and retrieve_python
functions in the communication module. These functions are designed to work with each other and allow for the Boxappend_python
and retrieve_python
functions must write directly to the buffer so that the alignment is known.