The OpenD Programming Language

ionPutEnd

size_t
ionPutEnd
()

Examples

    import mir.ion.type_code;

    ubyte[1024] data;
    auto pos = ionPutStartLength;

    ubyte[] result = [0xB0];
    assert(data[0 .. ionPutEnd(data.ptr, IonTypeCode.list, 0)] == result);

    result = [ubyte(0xB6), ubyte(0x85)] ~ cast(ubyte[])"hello";
    auto len = ionPut(data.ptr + pos, "hello");
    assert(data[0 .. ionPutEnd(data.ptr, IonTypeCode.list, len)] == result);

    result = [0xCE, 0x90, 0x8E, 0x8E];
    result ~= cast(ubyte[])"hello world!!!";
    len = ionPut(data.ptr + pos, "hello world!!!");
    assert(data[0 .. ionPutEnd(data.ptr, IonTypeCode.sexp, len)] == result);

    auto bm = `
Generating test runner configuration 'mir-ion-test-library' for 'library' (library).
Performing "unittest" build using /Users/9il/dlang/ldc2/bin/ldc2 for x86_64.
mir-core 1.1.7: target for configuration "library" is up to date.
mir-algorithm 3.9.2: target for configuration "default" is up to date.
mir-cpuid 1.2.6: target for configuration "library" is up to date.
mir-ion 0.5.7+commit.70.g7dcac11: building configuration "mir-ion-test-library"...
Linking...
To force a rebuild of up-to-date targets, run again with --force.
Running ./mir-ion-test-library`;

    result = [0xBE, 0x04, 0xB0, 0x8E, 0x04, 0xAD];
    result ~= cast(ubyte[])bm;
    len = ionPut(data.ptr + pos, bm);
    assert(data[0 .. ionPutEnd(data.ptr, IonTypeCode.list, len)] == result);

Meta