pyany-serde

Crates.iopyany-serde
lib.rspyany-serde
version
sourcesrc
created_at2025-02-01 05:07:36.469451
updated_at2025-02-03 23:38:52.051587
descriptionSerialization and deserialization for Python objects
homepage
repository
max_upload_size
id1538166
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`
size0
(JPK314)

documentation

README

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 for custom composition with other instances of Box (such as that for List) without needing to write any Rust code. The constructors for these are exposed via DynPyAnySerdeFactory.

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 Box to be wrapped in an Option. In the case that the Option is None, the Box to be used is dynamically determined based on the object provided for serialization, and the information needed to reconstruct this Box when deserializing is passed in the buffer (except in some cases where the information needed for reconstruction is too complex, such as UnionSerde, PythonSerdeSerde, or some other struct implementing Box not defined in this crate). Some structs (like NumpyDynamicShapeSerde) implementing the PyAnySerde trait rely on alignment for deserialization, and so these append_python and retrieve_python functions must write directly to the buffer so that the alignment is known.

Commit count: 0

cargo fmt