macro_rules! serialize_trait_object {
    ($($path:tt)+) => { ... };
}
Expand description

Implement serde::Serialize for a trait object that has erased_serde::Serialize as a supertrait.

use erased_serde::serialize_trait_object;

trait Event: erased_serde::Serialize {
    /* ... */
}

erased_serde::serialize_trait_object!(Event);

The macro supports traits that have type parameters and/or where clauses.

trait Difficult<T>: erased_serde::Serialize where T: Copy {
    /* ... */
}

serialize_trait_object!(<T> Difficult<T> where T: Copy);