Cerealed v0.6.1: even less boilerplate for binary serialization

Dicebot via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Mon Aug 3 08:51:06 PDT 2015


On Monday, 3 August 2015 at 09:40:59 UTC, Atila Neves wrote:
> In this case, yes. In the real-life case I was simplifying, it 
> wasn't a ubyte[] array, it was an array of structs with 
> non-trivial serialisation that also depended on a previous 
> deserialised variable. It was more like this:
>
> struct Outer {
>    static struct Header { ... }
>    Header header;
>    @LengthInBytes("length - headerSize") Inner[] array;
> }
>
> struct Inner {
>     static struct Header { ... }
>     Header header;
>     @ArrayLength("length") Unit[] units; //actual length of the 
> array instead of in bytes
> }
>
> struct Unit { ... }
>
> So maybe not as useless after all ;)
>
> Atila

Thanks. Very nice indeed.


More information about the Digitalmars-d-announce mailing list