- protobuf_serialize_to_codes(+Term:dict, -MessageType:atom, -WireCodes:list(int)) is det
- Process a Prolog term into bytes (list of int) that is the serialized form of a
message (designated by
MessageType).Protocmust have been run (with the--swipl_out=option and the resulting top-level _pb.plfile loaded. For more details, see the "protoc" section of the overview documentation.Fails if the term isn't of an appropriate form or if the appropriate meta-data from
protochasn't been loaded, or if a field name is incorrect (and therefore nothing in the meta-data matches it).- Arguments:
-
Term - The Prolog form of the data, as nested dicts. MessageType - Fully qualified message name (from the .protofile'spackageandmessage). For example, if thepackageisgoogle.protobufand the message isFileDescriptorSet, then you would use'.google.protobuf.FileDescriptorSet'or'google.protobuf.FileDescriptorSet'. If there's no package name, use e.g.:'MyMessageor'.MyMessage'. You can see the packages by looking atprotobufs:proto_meta_package(Pkg,File,_)and the message names and fields byprotobufs:proto_meta_field_name('.google.protobuf.FileDescriptorSet', FieldNumber, FieldName, FqnName)(the initial '.' is not optional for these facts, only for the top-level name given to protobuf_serialize_to_codes/3).WireCodes - Wire format of the message, which can be output using format('~s', [WireCodes]). - Errors
- -
version_error(Module-Version)you need to recompile theModulewith a newer version ofprotoc. - - existence_error if a field can't be found in the meta-data
- See also
- -
library(protobufs): Google's Protocol Buffers - bug
- -
mapfields don't get special treatment (but see protobuf_map_pairs/3). - -
oneofis not checked for validity.