pw_protobuf: Encoder rework Rewrites the pw_protobuf encoder to be oriented around pw_stream compatibility. Improvements: * Only the deepest nested encoder can be used at any given moment. Using a parent encoder triggers a crash rather than silently corrupting data. * Nested depth is bounded by scratch buffer size and stack usage rather than template arguments. * Can write to pw::stream::Writer objects without any temporary buffer. * Encoders can be explicitly finalized to allow returning to the parent encoder for further modifications without needing to create scopes to handle RAII behavior. * Proto encode interfaces can standardize on the StreamingEncoder as any StreamingEncoder can nest until the temporary buffer is exhausted. * Better handling of endianness. Change-Id: I3c50abbf2fe28328a9cb1aa527cf829abe583218 Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/40245 Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com> Pigweed-Auto-Submit: Armando Montanez <amontanez@google.com> Reviewed-by: Wyatt Hepler <hepler@google.com> Reviewed-by: Ewout van Bekkum <ewout@google.com> Reviewed-by: Keir Mierle <keir@google.com>
See our website: http://pigweed.dev