19 stable releases

1.6.0 Jun 12, 2023
1.5.5 Jun 4, 2023
1.5.3 Oct 28, 2022
1.5.2 Jul 2, 2022
1.4.2 May 16, 2022

#277 in Parser implementations

Download history 49/week @ 2024-01-08 20/week @ 2024-01-15 7/week @ 2024-01-22 7/week @ 2024-01-29 45/week @ 2024-02-05 78/week @ 2024-02-12 52/week @ 2024-02-19 80/week @ 2024-02-26 50/week @ 2024-03-04 140/week @ 2024-03-11 43/week @ 2024-03-18 56/week @ 2024-03-25 92/week @ 2024-04-01 32/week @ 2024-04-08 44/week @ 2024-04-15 47/week @ 2024-04-22

224 downloads per month
Used in 15 crates (3 directly)





Intermediate representation for Rust's Serde serialization

Table of contents

  1. Goals
  2. Installation
  3. Examples


This crate was made to solve these particular problems:

  • Provide untyped (obviously "fat") runtime value representation used as exchange data ready to be deserialized on demand into typed data, for data where serializable tagged trait objects don't work on taret platforms.

    Example: data stored in interpreted language runtime value.

  • Support for more interpreted than exact data conversion (if it quacks like a duck, treat it like a duck) which is default behavior, optionally force to read exact layout stored in value.

    Example: more forgiving convertion between unrelated data formats.

  • Support for versioning (allow to produce diffs between two versions of data, that can be later patched on demand).

    Example: Game assets content difference for DLC or any episodic content usage; editor UI sending only changes to the game runtime to patch what actually changed in the world (instead of sending entire serialized object state).

  • Support for tagged intermediate data.

    Example: Game asset stores data of type that is decided at runtime (associated tag gives hint what type its layout represents).


  1. Core crate with most important Intermediate and ReflectIntermediate types:

    serde-intermediate = "*"

    If you prefer to compile without ReflectIntermediate derive macro (derive feature adds derive macros and is enabled by default):

    serde-intermediate = { version = "*", default-features = false }
  2. Crate that adds support for tagged intermediate value (to embed tagged Intermediate in other serializable data with TaggedIntermediate type):

    serde-tagged-intermediate = "*"

    Same as with core crate, you can exclude ReflectIntermediate from compilation:

    serde-tagged-intermediate = { version = "*", default-features = false }



use std::time::SystemTime;
use serde::{Serialize, Deserialize};

#[derive(Debug, PartialEq, Serialize, Deserialize)]
enum Login {
        service: String,
        token: String,
        last_login: Option<SystemTime>,

#[derive(Debug, PartialEq, Serialize, Deserialize)]
struct Person {
    // (first name, last name)
    name: (String, String),
    age: usize,
    login: Login,

let data = Person {
    name: ("John".to_owned(), "Smith".to_owned()),
    age: 40,
    login: Login::Email("john.smith@gmail.com".to_owned()),
let serialized = serde_intermediate::to_intermediate(&data).unwrap();
let deserialized = serde_intermediate::from_intermediate(&serialized).unwrap();
assert_eq!(data, deserialized);

More elaborate problems and solutions:

  1. Versioning (diff/patch) (test_versioning)
  2. Conversion between data layouts (test_transform)
  3. DLC / episodic content (test_dlcs)
  4. Data change communication between game and editor (test_editor_communication)

License: MIT OR Apache-2.0


~93K SLoC