buffa-build 0.6 has use_bytes_type() / use_bytes_type_in(&[paths]) to map proto bytes → bytes::Bytes instead of Vec<u8>. There is no symmetric control for proto string: generated code always uses String.
Request: a parallel knob — e.g. use_string_type() / use_string_type_in(&[paths]) (or string_type(StringRepr)) — mapping proto string to a configurable immutable string type such as smol_str::SmolStr.
Motivation: We migrated a large hand-written proto3 surface (~138 messages) to buffa. The in-memory model is read-mostly and never mutates strings in place, so String's growable buffer is unnecessary; SmolStr gives inline storage for short strings (identifiers, codes, language tags) and O(1) clone for long ones, with no wire-format change. use_bytes_type already covers our bytes fields; string is the only remaining gap.
Implementation note: the codegen already parameterizes the field type for bytes via bytes_fields; a symmetric string_fields + chosen type appears to mirror that path. The selected type would need the same trait surface buffa relies on (Clone/PartialEq/Debug/Default, plus the serde and arbitrary impls already feature-gated like today's json/arbitrary). SmolStr satisfies these. No wire-encoding impact (UTF-8 bytes unchanged).
Happy to send a PR if the direction is acceptable.
buffa-build0.6 hasuse_bytes_type()/use_bytes_type_in(&[paths])to map protobytes→bytes::Bytesinstead ofVec<u8>. There is no symmetric control for protostring: generated code always usesString.Request: a parallel knob — e.g.
use_string_type()/use_string_type_in(&[paths])(orstring_type(StringRepr)) — mapping protostringto a configurable immutable string type such assmol_str::SmolStr.Motivation: We migrated a large hand-written proto3 surface (~138 messages) to buffa. The in-memory model is read-mostly and never mutates strings in place, so
String's growable buffer is unnecessary;SmolStrgives inline storage for short strings (identifiers, codes, language tags) and O(1) clone for long ones, with no wire-format change.use_bytes_typealready covers ourbytesfields;stringis the only remaining gap.Implementation note: the codegen already parameterizes the field type for
bytesviabytes_fields; a symmetricstring_fields+ chosen type appears to mirror that path. The selected type would need the same trait surface buffa relies on (Clone/PartialEq/Debug/Default, plus theserdeandarbitraryimpls already feature-gated like today'sjson/arbitrary).SmolStrsatisfies these. No wire-encoding impact (UTF-8 bytes unchanged).Happy to send a PR if the direction is acceptable.