On 04/01/2013 04:38 PM, Jesse Phillips wrote:
On Monday, 1 April 2013 at 17:24:05 UTC, Matt Soucy wrote:
From what I got from the examples, Repeated fields are done roughly as
following:
auto msg = fields.map!(a=>a.serialize())().reduce!(a,b=>a~b)();
return ((id<<3)|2) ~ msg.length.toVarint() ~ msg;
Where msg is a ubyte[].
-Matt Soucy

I think that would fall under some form of compression, namely
compressing the ID :P

BTW, I love how easy that is to read.

So, I looked at the code I'm currently working on to handle these...and it's literally that, except "raw" instead of "fields". UFCS is kind of wonderful in places like this.

You're right, that does count as compression. It wouldn't be hard to number the fields during serialization, especially if you don't need to worry about the structure changing.

-Matt Soucy

Reply via email to