View Source Protobuf.Any (protobuf v0.16.0)

Provides functions for working with the google.protobuf.Any type.

Summary

Functions

Packs a Protobuf message into a Google.Protobuf.Any message.

Functions

Link to this function

pack(data)

View Source (since 0.16.0)
@spec pack(struct()) :: Google.Protobuf.Any.t()

Packs a Protobuf message into a Google.Protobuf.Any message.

Example

message = MyPkg.MyMessage.new(%{field: "value"})
any = Protobuf.Any.pack(message)
#=> %Google.Protobuf.Any{
#=>   type_url: "type.googleapis.com/my_pkg.MyMessage",
#=>   value: <<...>>
#=> }