Types
PBOption[defaultValue] = object
- Optional value type for protobuf fields. Allows distinguishing between "field not set" and "field set to default value". Only works with proto2. Source Edit
ProtobufEOFError = object of ProtobufReadError
- Error raised when unexpected end of input is encountered. Source Edit
ProtobufError = object of SerializationError
- Error raised when a protobuf decoding/encoding operation fails. Source Edit
ProtobufExt[FieldType; RootType; fieldName] = object
- Type marker for protobuf extension types. Used internally for type extensions. Source Edit
ProtobufFlags = enum VarIntLengthPrefix ## Flags that control protobuf encoding behavior.
- Source Edit
ProtobufGroupError = object of ProtobufValueError
- Error raised when a group (deprecated protobuf feature) is encountered. Source Edit
ProtobufMessageError = object of ProtobufReadError
- Error raised when a message structure is invalid. Source Edit
ProtobufReader = ref object stream*: InputStream closeAfter*: bool
- Reader for decoding protobuf format to Nim objects. Source Edit
ProtobufReadError = object of ProtobufError
- Error raised when reading a protobuf message fails. Source Edit
ProtobufValueError = object of ProtobufReadError
- Error raised when a field value is invalid. Source Edit
ProtobufWriter = object stream*: OutputStream flags*: set[ProtobufFlags]
- Writer for encoding Nim objects to protobuf format. Source Edit
Procs
proc finish(writer: ProtobufWriter): seq[byte] {....raises: [IOError], raises: [], gcsafe, tags: [RootEffect], forbids: [].}
- Source Edit
func init(T: type ProtobufReader; stream: InputStream; closeAfter: bool = true): T:type {. inline, ...raises: [], gcsafe.}
- Source Edit
func init(T: type ProtobufWriter; stream: OutputStream; flags: static set[ProtobufFlags] = {}): T:type {.inline, ...raises: [], gcsafe.}
- Source Edit
Templates
template fieldNumber(num: int) {.pragma.}
- Pragma to assign a field number to a protobuf field. Required for all fields. Field numbers must be unique within a message and should never change. Source Edit