View Source Protobuf.Text (protobuf v0.17.0)

Text encoding of Protobufs.

Compliant with the textproto spec, but without extensions or Google.Protobuf.Any support (yet).

Summary

Functions

Encodes a Protobuf struct to text.

Functions

Link to this function

encode(struct, opts \\ [])

View Source (since 0.17.0)
@spec encode(struct(), keyword()) :: binary()

Encodes a Protobuf struct to text.

Accepts the following options:

  • :max_line_width - maximum line width, in columns. Defaults to 80. Lines may still be bigger than the limit, depending on the data.

  • :print_unknown_fields? - if true, prints unknown fields. Notice this makes the output impossible to decode, per current Protobuf spec. Defaults to false.

Doesn't perform type validations. If input data is invalid, it produces undecodable output.