[][src]Macro ffi_support::implement_into_ffi_by_json

macro_rules! implement_into_ffi_by_json {
    ($($T:ty),* $(,)*) => { ... };
}

Implements IntoFfi for the provided types (more than one may be passed in) by converting to the type to a JSON string. This macro also allows you to return Vec<T> for the types, also by serialization to JSON (by way of IntoFfiJsonTag).

This is typically going to be used from the "Rust component", and not the "FFI component" (see the top level crate documentation for more information).

Note: Each type passed in must implement or derive serde::Serialize.

Panics

The IntoFfi implementation this macro generates may panic in the following cases:

  • You've passed a type that contains a Map that has non-string keys (which can't be represented in JSON).

  • You've passed a type which has a custom serializer, and the custom serializer failed.

These cases are both rare enough that this still seems fine for the majority of uses.