4 releases (2 breaking)

0.3.2 Jun 1, 2024
0.3.1 May 31, 2024
0.3.0 May 31, 2024
0.2.0 May 31, 2024
0.1.0 May 30, 2024

#9 in #marshal

Download history 6/week @ 2024-09-18 20/week @ 2024-09-25 12/week @ 2024-10-02 13/week @ 2024-10-09 56/week @ 2024-10-16 17/week @ 2024-10-23 16/week @ 2024-10-30 20/week @ 2024-11-06 5/week @ 2024-11-13 30/week @ 2024-11-20 25/week @ 2024-11-27 39/week @ 2024-12-04 26/week @ 2024-12-11 24/week @ 2024-12-18 33/week @ 2024-12-25 5/week @ 2025-01-01

106 downloads per month
Used in alox-48

MPL-2.0 license

29KB
572 lines

alox-48

alox-48 (short for aluminum oxide 48) is a crate for deserializing and serializing as well Ruby's Marshal data format, using a custom data format like serde.

alox-48 intends to provide almost perfect round-trip deserialization, with some exceptions:

  • Object links are not preserved. Object links are a way for Ruby to compact data in Marshal. They rely heavily on Ruby having a GC and thus do not map well to Rust.
  • Bignum is unsupported.

Why a custom data format

Originally this crate relied on nightly to extend serde, using min_speciailization. Unfortunately that had many shortcomings and the deserializer would frequently choke on valid inputs and the serializer would spit out invalid data.

Most issues revolved around symbols- ruby uses @ prefixed symbols for instance variables, but also accepts variables without the prefix, silently discarding them.

I'm working on a separate serde adapter that can interface serde's data format with alox's, but that looks like it'll be nightly only.

Dependencies

~1–1.5MB
~33K SLoC