That’s fair. I’m having some corruption issues so I’m trying to layer a framing message around cap’n’proto that has the length of the payload (+ checksums) which is where the length in bytes comes in useful.
On Wed, May 6, 2020 at 3:07 PM Kenton Varda <[email protected]> wrote: > Eh, I like having the APIs be in words in hopes that it reminds people to > think about alignment. When allocating space for a capnp message, you > should always allocate an array of words, not an array of bytes. > > Seems not too hard for the caller to multiply by sizeof(capnp::word) if > needed? > > > -Kenton > > On Wed, May 6, 2020 at 4:49 PM Vitali Lovich <[email protected]> wrote: > >> The optometrist tells me I have 20/20 vision but I think it must clearly >> be a lie at this point :). Any objection to a contribution to return the >> size in bytes? >> >> On Wed, May 6, 2020 at 2:29 PM Kenton Varda <[email protected]> >> wrote: >> >>> I think this is what you want: >>> >>> >>> https://github.com/capnproto/capnproto/blob/3f0fee61c65475c8debfdf8c01f96c2f7e7eeb14/c++/src/capnp/serialize.h#L102 >>> >>> :) >>> >>> -Kenton >>> >>> On Wed, May 6, 2020 at 2:54 PM <[email protected]> wrote: >>> >>>> Is there a convenient way to peek at the size a message will take up on >>>> the wire? My thinking is to create a custom output stream that I >>>> `capnp::writeMessage` to that just sums everything but I feel like this >>>> could be done more efficiently within capn'n'proto, just couldn't find >>>> anything like that at first glance. Is there an obvious API missing? Would >>>> there be any interest in me putting up a diff with such an API? >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "Cap'n Proto" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to [email protected]. >>> >>> >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/capnproto/d47d474c-f268-4053-99ca-b2213a2e58d0%40googlegroups.com >>>> <https://groups.google.com/d/msgid/capnproto/d47d474c-f268-4053-99ca-b2213a2e58d0%40googlegroups.com?utm_medium=email&utm_source=footer> >>>> . >>>> >>> -- You received this message because you are subscribed to the Google Groups "Cap'n Proto" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/capnproto/CAF8PYMhdYmmh98DgOrzzzNk_43uN2u9ODUYae79E-rgavH8xoA%40mail.gmail.com.
