protobuf — Logtalk 3.100.1

object

# `protobuf`

Google Protocol Buffers binary format parser and generator.

Availability:
`logtalk_load(protobuf(loader))`
Author: Paulo Moura
Version: 1:1:0
Date: 2026-05-09
Compilation flags:
`static, context_switching_calls`
Uses:
ieee_754(Precision,ByteOrder,NaNRepresentation)
json(ObjectRepresentation,PairRepresentation,StringRepresentation)
list
reader
Remarks:
(none)
Inherited public predicates:
(none)

## Public predicates

### `parse/2`

Parses Protocol Buffers binary data from the given source (`bytes(List)`, `stream(Stream)`, or `file(Path)`) returning a `Schema-Data` pair. When the schema is not present in the file, `Schema` is unified with `false`.

Compilation flags:
`static`
Template:
`parse(Source,Schema-Data)`
Mode and number of proofs:
`parse(++compound,--pair)` - `one_or_error`

### `parse/3`

Parses Protocol Buffers binary data from the given source using the provided schema, returning the decoded data.

Compilation flags:
`static`
Template:
`parse(Source,Schema,Data)`
Mode and number of proofs:
`parse(++compound,++term,--term)` - `one_or_error`

### `generate/3`

Generates Protocol Buffers binary data to the given sink (`bytes(List)`, `stream(Stream)`, or `file(Path)`) from the given schema and data. The schema is not included in the output.

Compilation flags:
`static`
Template:
`generate(Sink,Schema,Data)`
Mode and number of proofs:
`generate(++compound,++term,++term)` - `one_or_error`

### `generate/4`

Generates Protocol Buffers binary data to the given sink from the given schema and data. When `IncludeSchema` is `true`, the schema is embedded in a wrapper message.

Compilation flags:
`static`
Template:
`generate(Sink,IncludeSchema,Schema,Data)`
Mode and number of proofs:
`generate(++compound,++boolean,++term,++term)` - `one_or_error`

## Protected predicates

(no local declarations; see entity ancestors if any)

## Private predicates

(no local declarations; see entity ancestors if any)

## Operators

(none)