Deserializeable trait objects

Documentation Crates.io

Documentation for the master branch

A dirty hack to support deserialization of arbitrary trait objects.

This is a proof-of-concept created in response to rust-lang/rfcs#668 as well as Dmitry Gordon's question How can deserialization of polymorphic trait objects be added in Rust if at all? (related Rust Forum post).

Caveat emptor

Deserialization may cause arbitrary code execution. The library has some sanity checks to make it hard to accidentally screw up, but there's no guarantee that this library is safe against a malicious attacker.

Even for trusted data, deserializing may cause undefined behavior on platforms and configurations that violate any of the following assumptions:

If Rust adds support for #[repr(align = "N")], it may be possible to use a custom alignment as a secondary sanity check.