The OpenD Programming Language

serde

Serialize value to binary ion data and deserialize it back to requested type. Uses GC allocated string tables.

template serde(T)
T
serde
(
V
)
(
auto ref scope const V value
,)
if (
!is(immutable V == immutable IonValueStream)
)

Examples

import mir.ion.stream: IonValueStream;
import mir.algebraic_alias.json: JsonAlgebraic;
static struct S
{
    double a;
    string s;
}
auto s = S(12.34, "str");
assert(s.serde!JsonAlgebraic.serde!S == s);
assert(s.serde!IonValueStream.serde!S == s);

Meta