[][src]Macro erased_serde::serialize_trait_object

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

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

#[macro_use]
extern crate erased_serde;

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

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);