Macro ffi_support::implement_into_ffi_by_json [−][src]
Implements [IntoFfi
] for the provided types (more than one may be passed
in) by converting to the type to a JSON string.
Additionally, most of the time we recomment using this crate’s protobuf support, instead of JSON.
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
.
Note: for this to works, the crate it’s called in must depend on serde
and
serde_json
.
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.