serde

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

  1. T serde(V value, int serdeTarget)
    template serde(T)
    T
    serde
    (
    V
    )
    (
    auto scope ref const V value
    ,
    int serdeTarget = SerdeTarget.ion
    )
    if (
    !is(immutable T == immutable IonValueStream)
    )
  2. void serde(T target, V value, int serdeTarget)
  3. void serde(T target, IonValueStream stream, int serdeTarget)
  4. template serde(T)

Members

Functions

serde
T serde(V value, int serdeTarget)
serde
void serde(T target, V value, int serdeTarget)
void serde(T target, IonValueStream stream, int serdeTarget)

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