From 8fcf069c096d486220c338cc179c0024cda75071 Mon Sep 17 00:00:00 2001 From: aaumar25 Date: Fri, 16 Jan 2026 15:53:38 +0900 Subject: [PATCH 1/2] ci: bump zig version to 0.16.0-dev.2187+e2338edb4 --- .github/workflows/release.yml | 2 +- .github/workflows/test.yml | 2 +- build.zig | 5 ++--- build.zig.zon | 6 +++--- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 35c0dbd..51ae0b2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -35,7 +35,7 @@ jobs: - uses: mlugg/setup-zig@v2 with: - version: 0.15.1 + version: 0.16.0-dev.2187+e2338edb4 - uses: actions/github-script@v7 id: parse-version-protobuf diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c0af99c..5628312 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -31,7 +31,7 @@ jobs: - uses: mlugg/setup-zig@v2 with: - version: 0.15.1 + version: 0.16.0-dev.2187+e2338edb4 - name: Run zig fmt if: matrix.os == 'Linux' diff --git a/build.zig b/build.zig index 961c45d..bdf1f46 100644 --- a/build.zig +++ b/build.zig @@ -41,13 +41,12 @@ pub fn build(b: *std.Build) !void { ); const protoc_step = protobuf.RunProtocStep.create( - b, protobuf_dep.builder, target, .{ .destination_directory = b.path("src/protobuf"), - .source_files = &.{"mmc.proto"}, - .include_directories = &.{"protobuf"}, + .source_files = &.{b.path("protobuf/mmc.proto")}, + .include_directories = &.{b.path("protobuf")}, }, ); diff --git a/build.zig.zon b/build.zig.zon index cfb472d..fb429a7 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -2,11 +2,11 @@ .name = .mmc_api, .version = "0.0.0", .fingerprint = 0xdcdffdab47da9a3f, - .minimum_zig_version = "0.15.2", + .minimum_zig_version = "0.16.0-dev.2187+e2338edb4", .dependencies = .{ .protobuf = .{ - .url = "https://github.com/mochalins/protobuf.zig/archive/477466e.tar.gz", - .hash = "protobuf-0.1.0-0e82aqvRAwBo5-ccOGlXywY9X4lkQUx02CwMBE_fq4AI", + .url = "https://github.com/Arwalk/zig-protobuf/archive/c3f8fdc.tar.gz", + .hash = "protobuf-3.0.0-0e82aohXKQDcG92gcsmBaK7hZ9PVbwcCND1hyCEtzgd9", }, }, .paths = .{""}, From 2f14fced17e866b144a00535e2b67898d7fe7f5c Mon Sep 17 00:00:00 2001 From: aaumar25 Date: Fri, 16 Jan 2026 15:53:57 +0900 Subject: [PATCH 2/2] refactor: Update generated zig to master --- protobuf/mmc/info.proto | 14 +- protobuf/range.proto | 1 + src/protobuf/mmc.pb.zig | 168 +++++-- src/protobuf/mmc/command.pb.zig | 809 +++++++++++++++++++++----------- src/protobuf/mmc/core.pb.zig | 210 +++++---- src/protobuf/mmc/info.pb.zig | 567 +++++++++++++--------- 6 files changed, 1149 insertions(+), 620 deletions(-) diff --git a/protobuf/mmc/info.proto b/protobuf/mmc/info.proto index 799605d..911ed9a 100644 --- a/protobuf/mmc/info.proto +++ b/protobuf/mmc/info.proto @@ -15,7 +15,9 @@ message Request { // ID is provided, then request for status of all commands from the server. // // Expected response: `mmc.Response.body.info.body.commands` - message Command { optional uint32 id = 1; } + message Command { + optional uint32 id = 1; + } // Request track state information from server. One or more of the `info_` // flags must be enabled to select the kind of track information desired. @@ -62,7 +64,9 @@ message Request { } // List of IDs. At least one ID must be provided. - message Ids { repeated uint32 ids = 1; } + message Ids { + repeated uint32 ids = 1; + } } enum Error { @@ -94,7 +98,9 @@ message Response { Request.Error request_error = 3; } - message Commands { repeated Command items = 1; } + message Commands { + repeated Command items = 1; + } message Command { // Command ID. Valid IDs begin from 1, and may be reused after command @@ -127,7 +133,7 @@ message Response { COMMAND_ERROR_INVALID_SYSTEM_STATE = 1; // Deprecated. Check `COMMAND_REQUEST_ERROR_INVALID_CARRIER` on // `Command.Request.Error`. - COMMAND_ERROR_INVALID_CARRIER_ID = 2 [ deprecated = true ]; + COMMAND_ERROR_INVALID_CARRIER_ID = 2 [deprecated = true]; // Driver connection failed while command progressing. COMMAND_ERROR_DRIVER_DISCONNECTED = 3; // Unexpected command execution error. This is likely an implementation diff --git a/protobuf/range.proto b/protobuf/range.proto index bab968b..647f29f 100644 --- a/protobuf/range.proto +++ b/protobuf/range.proto @@ -1,4 +1,5 @@ syntax = "proto3"; +package mmc; message Range { // Start of range, inclusive. diff --git a/src/protobuf/mmc.pb.zig b/src/protobuf/mmc.pb.zig index a171dd0..0b84221 100644 --- a/src/protobuf/mmc.pb.zig +++ b/src/protobuf/mmc.pb.zig @@ -2,15 +2,16 @@ ///! package mmc const std = @import("std"); -const pb = @import("protobuf"); -const fd = pb.fd; +const protobuf = @import("protobuf"); +const fd = protobuf.fd; /// import package mmc.core -pub const core = @import("mmc/core.pb.zig"); +const mmc_core = @import("mmc/core.pb.zig"); /// import package mmc.command -pub const command = @import("mmc/command.pb.zig"); +const mmc_command = @import("mmc/command.pb.zig"); /// import package mmc.info -pub const info = @import("mmc/info.pb.zig"); +const mmc_info = @import("mmc/info.pb.zig"); +/// Carrier motor control kind. pub const Control = enum(i32) { CONTROL_UNSPECIFIED = 0, CONTROL_POSITION = 1, @@ -18,6 +19,81 @@ pub const Control = enum(i32) { _, }; +pub const Range = struct { + start: u32 = 0, + end: u32 = 0, + + pub const _desc_table = .{ + .start = fd(1, .{ .scalar = .uint32 }), + .end = fd(2, .{ .scalar = .uint32 }), + }; + + /// Encodes the message to the writer + /// The allocator is used to generate submessages internally. + /// Hence, an ArenaAllocator is a preferred choice if allocations are a bottleneck. + pub fn encode( + self: @This(), + writer: *std.Io.Writer, + allocator: std.mem.Allocator, + ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { + return protobuf.encode(writer, allocator, self); + } + + /// Decodes the message from the bytes read from the reader. + pub fn decode( + reader: *std.Io.Reader, + allocator: std.mem.Allocator, + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); + } + + /// Deinitializes and frees the memory associated with the message. + pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { + return protobuf.deinit(allocator, self); + } + + /// Duplicates the message. + pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { + return protobuf.dupe(@This(), self, allocator); + } + + /// Decodes the message from the JSON string. + pub fn jsonDecode( + input: []const u8, + options: std.json.ParseOptions, + allocator: std.mem.Allocator, + ) !std.json.Parsed(@This()) { + return protobuf.json.decode(@This(), input, options, allocator); + } + + /// Encodes the message to a JSON string. + pub fn jsonEncode( + self: @This(), + options: std.json.Stringify.Options, + allocator: std.mem.Allocator, + ) ![]const u8 { + return protobuf.json.encode(self, options, allocator); + } + + /// This method is used by std.json + /// internally for deserialization. DO NOT RENAME! + pub fn jsonParse( + allocator: std.mem.Allocator, + source: anytype, + options: std.json.ParseOptions, + ) !@This() { + return protobuf.json.parse(@This(), allocator, source, options); + } + + /// This method is used by std.json + /// internally for serialization. DO NOT RENAME! + pub fn jsonStringify(self: *const @This(), jws: anytype) !void { + return protobuf.json.stringify(@This(), self, jws); + } +}; + +/// Request message. All client-to-server messages should be of this message +/// type. pub const Request = struct { body: ?body_union = null, @@ -27,9 +103,9 @@ pub const Request = struct { info, }; pub const body_union = union(_body_case) { - core: core.Request, - command: command.Request, - info: info.Request, + core: mmc_core.Request, + command: mmc_command.Request, + info: mmc_info.Request, pub const _desc_table = .{ .core = fd(1, .submessage), .command = fd(2, .submessage), @@ -47,62 +123,72 @@ pub const Request = struct { _, }; + /// Encodes the message to the writer + /// The allocator is used to generate submessages internally. + /// Hence, an ArenaAllocator is a preferred choice if allocations are a bottleneck. pub fn encode( self: @This(), writer: *std.Io.Writer, allocator: std.mem.Allocator, ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { - return pb.encode(writer, allocator, self); + return protobuf.encode(writer, allocator, self); } + /// Decodes the message from the bytes read from the reader. pub fn decode( reader: *std.Io.Reader, allocator: std.mem.Allocator, - ) (pb.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { - return pb.decode(@This(), reader, allocator); + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); } + /// Deinitializes and frees the memory associated with the message. pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { - return pb.deinit(allocator, self); + return protobuf.deinit(allocator, self); } + /// Duplicates the message. pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { - return pb.dupe(@This(), self, allocator); + return protobuf.dupe(@This(), self, allocator); } + /// Decodes the message from the JSON string. pub fn jsonDecode( input: []const u8, options: std.json.ParseOptions, allocator: std.mem.Allocator, ) !std.json.Parsed(@This()) { - return pb.json.decode(@This(), input, options, allocator); + return protobuf.json.decode(@This(), input, options, allocator); } + /// Encodes the message to a JSON string. pub fn jsonEncode( self: @This(), options: std.json.Stringify.Options, allocator: std.mem.Allocator, ) ![]const u8 { - return pb.json.encode(self, options, allocator); + return protobuf.json.encode(self, options, allocator); } - // This method is used by std.json - // internally for deserialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for deserialization. DO NOT RENAME! pub fn jsonParse( allocator: std.mem.Allocator, source: anytype, options: std.json.ParseOptions, ) !@This() { - return pb.json.parse(@This(), allocator, source, options); + return protobuf.json.parse(@This(), allocator, source, options); } - // This method is used by std.json - // internally for serialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for serialization. DO NOT RENAME! pub fn jsonStringify(self: *const @This(), jws: anytype) !void { - return pb.json.stringify(@This(), self, jws); + return protobuf.json.stringify(@This(), self, jws); } }; +/// Response message. All server-to-client messages will be of this message +/// type. pub const Response = struct { body: ?body_union = null, @@ -113,9 +199,9 @@ pub const Response = struct { request_error, }; pub const body_union = union(_body_case) { - core: core.Response, - command: command.Response, - info: info.Response, + core: mmc_core.Response, + command: mmc_command.Response, + info: mmc_info.Response, request_error: Request.Error, pub const _desc_table = .{ .core = fd(1, .submessage), @@ -129,58 +215,66 @@ pub const Response = struct { .body = fd(null, .{ .oneof = body_union }), }; + /// Encodes the message to the writer + /// The allocator is used to generate submessages internally. + /// Hence, an ArenaAllocator is a preferred choice if allocations are a bottleneck. pub fn encode( self: @This(), writer: *std.Io.Writer, allocator: std.mem.Allocator, ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { - return pb.encode(writer, allocator, self); + return protobuf.encode(writer, allocator, self); } + /// Decodes the message from the bytes read from the reader. pub fn decode( reader: *std.Io.Reader, allocator: std.mem.Allocator, - ) (pb.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { - return pb.decode(@This(), reader, allocator); + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); } + /// Deinitializes and frees the memory associated with the message. pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { - return pb.deinit(allocator, self); + return protobuf.deinit(allocator, self); } + /// Duplicates the message. pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { - return pb.dupe(@This(), self, allocator); + return protobuf.dupe(@This(), self, allocator); } + /// Decodes the message from the JSON string. pub fn jsonDecode( input: []const u8, options: std.json.ParseOptions, allocator: std.mem.Allocator, ) !std.json.Parsed(@This()) { - return pb.json.decode(@This(), input, options, allocator); + return protobuf.json.decode(@This(), input, options, allocator); } + /// Encodes the message to a JSON string. pub fn jsonEncode( self: @This(), options: std.json.Stringify.Options, allocator: std.mem.Allocator, ) ![]const u8 { - return pb.json.encode(self, options, allocator); + return protobuf.json.encode(self, options, allocator); } - // This method is used by std.json - // internally for deserialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for deserialization. DO NOT RENAME! pub fn jsonParse( allocator: std.mem.Allocator, source: anytype, options: std.json.ParseOptions, ) !@This() { - return pb.json.parse(@This(), allocator, source, options); + return protobuf.json.parse(@This(), allocator, source, options); } - // This method is used by std.json - // internally for serialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for serialization. DO NOT RENAME! pub fn jsonStringify(self: *const @This(), jws: anytype) !void { - return pb.json.stringify(@This(), self, jws); + return protobuf.json.stringify(@This(), self, jws); } }; diff --git a/src/protobuf/mmc/command.pb.zig b/src/protobuf/mmc/command.pb.zig index cbd0c72..03dc889 100644 --- a/src/protobuf/mmc/command.pb.zig +++ b/src/protobuf/mmc/command.pb.zig @@ -2,13 +2,17 @@ ///! package mmc.command const std = @import("std"); -const pb = @import("protobuf"); -const fd = pb.fd; -/// import package protobuf -const protobuf = @import("../protobuf.pb.zig"); +const protobuf = @import("protobuf"); +const fd = protobuf.fd; /// import package mmc const mmc = @import("../mmc.pb.zig"); +/// Command API: List of commands to operate the PMF's motion system. +/// +/// When a command is sent to the server, it will be queued for execution. +/// Command execution status can be polled through the Info API. The status +/// remains stored in a limited history buffer, and should be cleared with +/// `remove_command` after completion. pub const Request = struct { body: ?body_union = null, @@ -108,6 +112,10 @@ pub const Request = struct { _, }; + /// Release the control imposed by the motor to the carrier. If a target is + /// specified, the motor which is located on the target release the control. + /// Otherwise, all carriers on the provided line will be released from control. + /// Expected response: `mmc.Response.body.command.body.id` (uint32). pub const Release = struct { line: u32 = 0, target: ?target_union = null, @@ -119,8 +127,8 @@ pub const Request = struct { }; pub const target_union = union(_target_case) { carrier: u32, - axes: protobuf.Range, - drivers: protobuf.Range, + axes: mmc.Range, + drivers: mmc.Range, pub const _desc_table = .{ .carrier = fd(2, .{ .scalar = .uint32 }), .axes = fd(3, .submessage), @@ -133,192 +141,229 @@ pub const Request = struct { .target = fd(null, .{ .oneof = target_union }), }; + /// Encodes the message to the writer + /// The allocator is used to generate submessages internally. + /// Hence, an ArenaAllocator is a preferred choice if allocations are a bottleneck. pub fn encode( self: @This(), writer: *std.Io.Writer, allocator: std.mem.Allocator, ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { - return pb.encode(writer, allocator, self); + return protobuf.encode(writer, allocator, self); } + /// Decodes the message from the bytes read from the reader. pub fn decode( reader: *std.Io.Reader, allocator: std.mem.Allocator, - ) (pb.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { - return pb.decode(@This(), reader, allocator); + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); } + /// Deinitializes and frees the memory associated with the message. pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { - return pb.deinit(allocator, self); + return protobuf.deinit(allocator, self); } + /// Duplicates the message. pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { - return pb.dupe(@This(), self, allocator); + return protobuf.dupe(@This(), self, allocator); } + /// Decodes the message from the JSON string. pub fn jsonDecode( input: []const u8, options: std.json.ParseOptions, allocator: std.mem.Allocator, ) !std.json.Parsed(@This()) { - return pb.json.decode(@This(), input, options, allocator); + return protobuf.json.decode(@This(), input, options, allocator); } + /// Encodes the message to a JSON string. pub fn jsonEncode( self: @This(), options: std.json.Stringify.Options, allocator: std.mem.Allocator, ) ![]const u8 { - return pb.json.encode(self, options, allocator); + return protobuf.json.encode(self, options, allocator); } - // This method is used by std.json - // internally for deserialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for deserialization. DO NOT RENAME! pub fn jsonParse( allocator: std.mem.Allocator, source: anytype, options: std.json.ParseOptions, ) !@This() { - return pb.json.parse(@This(), allocator, source, options); + return protobuf.json.parse(@This(), allocator, source, options); } - // This method is used by std.json - // internally for serialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for serialization. DO NOT RENAME! pub fn jsonStringify(self: *const @This(), jws: anytype) !void { - return pb.json.stringify(@This(), self, jws); + return protobuf.json.stringify(@This(), self, jws); } }; + /// Stop pulling a carrier to the specified axis. If no axis is provided, + /// then all pending carrier pulls on the line will be stopped. + /// + /// Expected response: `mmc.Response.body.command.body.id` (uint32). pub const StopPull = struct { line: u32 = 0, - axes: ?protobuf.Range = null, + axes: ?mmc.Range = null, pub const _desc_table = .{ .line = fd(1, .{ .scalar = .uint32 }), .axes = fd(2, .submessage), }; + /// Encodes the message to the writer + /// The allocator is used to generate submessages internally. + /// Hence, an ArenaAllocator is a preferred choice if allocations are a bottleneck. pub fn encode( self: @This(), writer: *std.Io.Writer, allocator: std.mem.Allocator, ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { - return pb.encode(writer, allocator, self); + return protobuf.encode(writer, allocator, self); } + /// Decodes the message from the bytes read from the reader. pub fn decode( reader: *std.Io.Reader, allocator: std.mem.Allocator, - ) (pb.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { - return pb.decode(@This(), reader, allocator); + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); } + /// Deinitializes and frees the memory associated with the message. pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { - return pb.deinit(allocator, self); + return protobuf.deinit(allocator, self); } + /// Duplicates the message. pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { - return pb.dupe(@This(), self, allocator); + return protobuf.dupe(@This(), self, allocator); } + /// Decodes the message from the JSON string. pub fn jsonDecode( input: []const u8, options: std.json.ParseOptions, allocator: std.mem.Allocator, ) !std.json.Parsed(@This()) { - return pb.json.decode(@This(), input, options, allocator); + return protobuf.json.decode(@This(), input, options, allocator); } + /// Encodes the message to a JSON string. pub fn jsonEncode( self: @This(), options: std.json.Stringify.Options, allocator: std.mem.Allocator, ) ![]const u8 { - return pb.json.encode(self, options, allocator); + return protobuf.json.encode(self, options, allocator); } - // This method is used by std.json - // internally for deserialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for deserialization. DO NOT RENAME! pub fn jsonParse( allocator: std.mem.Allocator, source: anytype, options: std.json.ParseOptions, ) !@This() { - return pb.json.parse(@This(), allocator, source, options); + return protobuf.json.parse(@This(), allocator, source, options); } - // This method is used by std.json - // internally for serialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for serialization. DO NOT RENAME! pub fn jsonStringify(self: *const @This(), jws: anytype) !void { - return pb.json.stringify(@This(), self, jws); + return protobuf.json.stringify(@This(), self, jws); } }; + /// Stop pushing a carrier from the specified axis. If no axis is provided, + /// then all pending carrier pushes on the line will be stopped. + /// + /// Expected response: `mmc.Response.body.command.body.id` (uint32). pub const StopPush = struct { line: u32 = 0, - axes: ?protobuf.Range = null, + axes: ?mmc.Range = null, pub const _desc_table = .{ .line = fd(1, .{ .scalar = .uint32 }), .axes = fd(2, .submessage), }; + /// Encodes the message to the writer + /// The allocator is used to generate submessages internally. + /// Hence, an ArenaAllocator is a preferred choice if allocations are a bottleneck. pub fn encode( self: @This(), writer: *std.Io.Writer, allocator: std.mem.Allocator, ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { - return pb.encode(writer, allocator, self); + return protobuf.encode(writer, allocator, self); } + /// Decodes the message from the bytes read from the reader. pub fn decode( reader: *std.Io.Reader, allocator: std.mem.Allocator, - ) (pb.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { - return pb.decode(@This(), reader, allocator); + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); } + /// Deinitializes and frees the memory associated with the message. pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { - return pb.deinit(allocator, self); + return protobuf.deinit(allocator, self); } + /// Duplicates the message. pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { - return pb.dupe(@This(), self, allocator); + return protobuf.dupe(@This(), self, allocator); } + /// Decodes the message from the JSON string. pub fn jsonDecode( input: []const u8, options: std.json.ParseOptions, allocator: std.mem.Allocator, ) !std.json.Parsed(@This()) { - return pb.json.decode(@This(), input, options, allocator); + return protobuf.json.decode(@This(), input, options, allocator); } + /// Encodes the message to a JSON string. pub fn jsonEncode( self: @This(), options: std.json.Stringify.Options, allocator: std.mem.Allocator, ) ![]const u8 { - return pb.json.encode(self, options, allocator); + return protobuf.json.encode(self, options, allocator); } - // This method is used by std.json - // internally for deserialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for deserialization. DO NOT RENAME! pub fn jsonParse( allocator: std.mem.Allocator, source: anytype, options: std.json.ParseOptions, ) !@This() { - return pb.json.parse(@This(), allocator, source, options); + return protobuf.json.parse(@This(), allocator, source, options); } - // This method is used by std.json - // internally for serialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for serialization. DO NOT RENAME! pub fn jsonStringify(self: *const @This(), jws: anytype) !void { - return pb.json.stringify(@This(), self, jws); + return protobuf.json.stringify(@This(), self, jws); } }; + /// Clear all error information on the driver. If a target is specified, + /// clear error information of drivers which is located on the target. If not, + /// clear error information on every driver of the specified line ID. + /// + /// Expected response: `mmc.Response.body.command.body.id` (uint32). pub const ClearErrors = struct { line: u32 = 0, target: ?target_union = null, @@ -329,8 +374,8 @@ pub const Request = struct { carrier, }; pub const target_union = union(_target_case) { - drivers: protobuf.Range, - axes: protobuf.Range, + drivers: mmc.Range, + axes: mmc.Range, carrier: u32, pub const _desc_table = .{ .drivers = fd(2, .submessage), @@ -344,62 +389,75 @@ pub const Request = struct { .target = fd(null, .{ .oneof = target_union }), }; + /// Encodes the message to the writer + /// The allocator is used to generate submessages internally. + /// Hence, an ArenaAllocator is a preferred choice if allocations are a bottleneck. pub fn encode( self: @This(), writer: *std.Io.Writer, allocator: std.mem.Allocator, ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { - return pb.encode(writer, allocator, self); + return protobuf.encode(writer, allocator, self); } + /// Decodes the message from the bytes read from the reader. pub fn decode( reader: *std.Io.Reader, allocator: std.mem.Allocator, - ) (pb.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { - return pb.decode(@This(), reader, allocator); + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); } + /// Deinitializes and frees the memory associated with the message. pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { - return pb.deinit(allocator, self); + return protobuf.deinit(allocator, self); } + /// Duplicates the message. pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { - return pb.dupe(@This(), self, allocator); + return protobuf.dupe(@This(), self, allocator); } + /// Decodes the message from the JSON string. pub fn jsonDecode( input: []const u8, options: std.json.ParseOptions, allocator: std.mem.Allocator, ) !std.json.Parsed(@This()) { - return pb.json.decode(@This(), input, options, allocator); + return protobuf.json.decode(@This(), input, options, allocator); } + /// Encodes the message to a JSON string. pub fn jsonEncode( self: @This(), options: std.json.Stringify.Options, allocator: std.mem.Allocator, ) ![]const u8 { - return pb.json.encode(self, options, allocator); + return protobuf.json.encode(self, options, allocator); } - // This method is used by std.json - // internally for deserialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for deserialization. DO NOT RENAME! pub fn jsonParse( allocator: std.mem.Allocator, source: anytype, options: std.json.ParseOptions, ) !@This() { - return pb.json.parse(@This(), allocator, source, options); + return protobuf.json.parse(@This(), allocator, source, options); } - // This method is used by std.json - // internally for serialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for serialization. DO NOT RENAME! pub fn jsonStringify(self: *const @This(), jws: anytype) !void { - return pb.json.stringify(@This(), self, jws); + return protobuf.json.stringify(@This(), self, jws); } }; + /// Clear carrier information located on the axis. If a target is specified, + /// clear information of carriers which is located on the target. If not, + /// clear all carrier information of the specified line ID + /// + /// Expected response: `mmc.Response.body.command.body.id` (uint32). pub const Deinitialize = struct { line: u32 = 0, target: ?target_union = null, @@ -410,8 +468,8 @@ pub const Request = struct { carrier, }; pub const target_union = union(_target_case) { - axes: protobuf.Range, - drivers: protobuf.Range, + axes: mmc.Range, + drivers: mmc.Range, carrier: u32, pub const _desc_table = .{ .axes = fd(2, .submessage), @@ -425,62 +483,74 @@ pub const Request = struct { .target = fd(null, .{ .oneof = target_union }), }; + /// Encodes the message to the writer + /// The allocator is used to generate submessages internally. + /// Hence, an ArenaAllocator is a preferred choice if allocations are a bottleneck. pub fn encode( self: @This(), writer: *std.Io.Writer, allocator: std.mem.Allocator, ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { - return pb.encode(writer, allocator, self); + return protobuf.encode(writer, allocator, self); } + /// Decodes the message from the bytes read from the reader. pub fn decode( reader: *std.Io.Reader, allocator: std.mem.Allocator, - ) (pb.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { - return pb.decode(@This(), reader, allocator); + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); } + /// Deinitializes and frees the memory associated with the message. pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { - return pb.deinit(allocator, self); + return protobuf.deinit(allocator, self); } + /// Duplicates the message. pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { - return pb.dupe(@This(), self, allocator); + return protobuf.dupe(@This(), self, allocator); } + /// Decodes the message from the JSON string. pub fn jsonDecode( input: []const u8, options: std.json.ParseOptions, allocator: std.mem.Allocator, ) !std.json.Parsed(@This()) { - return pb.json.decode(@This(), input, options, allocator); + return protobuf.json.decode(@This(), input, options, allocator); } + /// Encodes the message to a JSON string. pub fn jsonEncode( self: @This(), options: std.json.Stringify.Options, allocator: std.mem.Allocator, ) ![]const u8 { - return pb.json.encode(self, options, allocator); + return protobuf.json.encode(self, options, allocator); } - // This method is used by std.json - // internally for deserialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for deserialization. DO NOT RENAME! pub fn jsonParse( allocator: std.mem.Allocator, source: anytype, options: std.json.ParseOptions, ) !@This() { - return pb.json.parse(@This(), allocator, source, options); + return protobuf.json.parse(@This(), allocator, source, options); } - // This method is used by std.json - // internally for serialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for serialization. DO NOT RENAME! pub fn jsonStringify(self: *const @This(), jws: anytype) !void { - return pb.json.stringify(@This(), self, jws); + return protobuf.json.stringify(@This(), self, jws); } }; + /// Calibrate a line by positioning an unitiliazed carrier on the first axis + /// of the line. + /// + /// Expected response: `mmc.Response.body.command.body.id` (uint32). pub const Calibrate = struct { line: u32 = 0, @@ -488,62 +558,74 @@ pub const Request = struct { .line = fd(1, .{ .scalar = .uint32 }), }; + /// Encodes the message to the writer + /// The allocator is used to generate submessages internally. + /// Hence, an ArenaAllocator is a preferred choice if allocations are a bottleneck. pub fn encode( self: @This(), writer: *std.Io.Writer, allocator: std.mem.Allocator, ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { - return pb.encode(writer, allocator, self); + return protobuf.encode(writer, allocator, self); } + /// Decodes the message from the bytes read from the reader. pub fn decode( reader: *std.Io.Reader, allocator: std.mem.Allocator, - ) (pb.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { - return pb.decode(@This(), reader, allocator); + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); } + /// Deinitializes and frees the memory associated with the message. pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { - return pb.deinit(allocator, self); + return protobuf.deinit(allocator, self); } + /// Duplicates the message. pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { - return pb.dupe(@This(), self, allocator); + return protobuf.dupe(@This(), self, allocator); } + /// Decodes the message from the JSON string. pub fn jsonDecode( input: []const u8, options: std.json.ParseOptions, allocator: std.mem.Allocator, ) !std.json.Parsed(@This()) { - return pb.json.decode(@This(), input, options, allocator); + return protobuf.json.decode(@This(), input, options, allocator); } + /// Encodes the message to a JSON string. pub fn jsonEncode( self: @This(), options: std.json.Stringify.Options, allocator: std.mem.Allocator, ) ![]const u8 { - return pb.json.encode(self, options, allocator); + return protobuf.json.encode(self, options, allocator); } - // This method is used by std.json - // internally for deserialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for deserialization. DO NOT RENAME! pub fn jsonParse( allocator: std.mem.Allocator, source: anytype, options: std.json.ParseOptions, ) !@This() { - return pb.json.parse(@This(), allocator, source, options); + return protobuf.json.parse(@This(), allocator, source, options); } - // This method is used by std.json - // internally for serialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for serialization. DO NOT RENAME! pub fn jsonStringify(self: *const @This(), jws: anytype) !void { - return pb.json.stringify(@This(), self, jws); + return protobuf.json.stringify(@This(), self, jws); } }; + /// Set a zero position of a line by positioning an initialized carrier on + /// the first axis of the line. + /// + /// Expected response: `mmc.Response.body.command.body.id` (uint32). pub const SetZero = struct { line: u32 = 0, @@ -551,62 +633,73 @@ pub const Request = struct { .line = fd(1, .{ .scalar = .uint32 }), }; + /// Encodes the message to the writer + /// The allocator is used to generate submessages internally. + /// Hence, an ArenaAllocator is a preferred choice if allocations are a bottleneck. pub fn encode( self: @This(), writer: *std.Io.Writer, allocator: std.mem.Allocator, ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { - return pb.encode(writer, allocator, self); + return protobuf.encode(writer, allocator, self); } + /// Decodes the message from the bytes read from the reader. pub fn decode( reader: *std.Io.Reader, allocator: std.mem.Allocator, - ) (pb.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { - return pb.decode(@This(), reader, allocator); + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); } + /// Deinitializes and frees the memory associated with the message. pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { - return pb.deinit(allocator, self); + return protobuf.deinit(allocator, self); } + /// Duplicates the message. pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { - return pb.dupe(@This(), self, allocator); + return protobuf.dupe(@This(), self, allocator); } + /// Decodes the message from the JSON string. pub fn jsonDecode( input: []const u8, options: std.json.ParseOptions, allocator: std.mem.Allocator, ) !std.json.Parsed(@This()) { - return pb.json.decode(@This(), input, options, allocator); + return protobuf.json.decode(@This(), input, options, allocator); } + /// Encodes the message to a JSON string. pub fn jsonEncode( self: @This(), options: std.json.Stringify.Options, allocator: std.mem.Allocator, ) ![]const u8 { - return pb.json.encode(self, options, allocator); + return protobuf.json.encode(self, options, allocator); } - // This method is used by std.json - // internally for deserialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for deserialization. DO NOT RENAME! pub fn jsonParse( allocator: std.mem.Allocator, source: anytype, options: std.json.ParseOptions, ) !@This() { - return pb.json.parse(@This(), allocator, source, options); + return protobuf.json.parse(@This(), allocator, source, options); } - // This method is used by std.json - // internally for serialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for serialization. DO NOT RENAME! pub fn jsonStringify(self: *const @This(), jws: anytype) !void { - return pb.json.stringify(@This(), self, jws); + return protobuf.json.stringify(@This(), self, jws); } }; + /// Automatically initialize carriers on every specified lines. + /// + /// Expected response: `mmc.Response.body.command.body.id` (uint32). pub const AutoInitialize = struct { lines: std.ArrayListUnmanaged(Request.AutoInitialize.Line) = .empty, @@ -627,118 +720,137 @@ pub const Request = struct { .velocity_mode = fd(4, .@"enum"), }; + /// Encodes the message to the writer + /// The allocator is used to generate submessages internally. + /// Hence, an ArenaAllocator is a preferred choice if allocations are a bottleneck. pub fn encode( self: @This(), writer: *std.Io.Writer, allocator: std.mem.Allocator, ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { - return pb.encode(writer, allocator, self); + return protobuf.encode(writer, allocator, self); } + /// Decodes the message from the bytes read from the reader. pub fn decode( reader: *std.Io.Reader, allocator: std.mem.Allocator, - ) (pb.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { - return pb.decode(@This(), reader, allocator); + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); } + /// Deinitializes and frees the memory associated with the message. pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { - return pb.deinit(allocator, self); + return protobuf.deinit(allocator, self); } + /// Duplicates the message. pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { - return pb.dupe(@This(), self, allocator); + return protobuf.dupe(@This(), self, allocator); } + /// Decodes the message from the JSON string. pub fn jsonDecode( input: []const u8, options: std.json.ParseOptions, allocator: std.mem.Allocator, ) !std.json.Parsed(@This()) { - return pb.json.decode(@This(), input, options, allocator); + return protobuf.json.decode(@This(), input, options, allocator); } + /// Encodes the message to a JSON string. pub fn jsonEncode( self: @This(), options: std.json.Stringify.Options, allocator: std.mem.Allocator, ) ![]const u8 { - return pb.json.encode(self, options, allocator); + return protobuf.json.encode(self, options, allocator); } - // This method is used by std.json - // internally for deserialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for deserialization. DO NOT RENAME! pub fn jsonParse( allocator: std.mem.Allocator, source: anytype, options: std.json.ParseOptions, ) !@This() { - return pb.json.parse(@This(), allocator, source, options); + return protobuf.json.parse(@This(), allocator, source, options); } - // This method is used by std.json - // internally for serialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for serialization. DO NOT RENAME! pub fn jsonStringify(self: *const @This(), jws: anytype) !void { - return pb.json.stringify(@This(), self, jws); + return protobuf.json.stringify(@This(), self, jws); } }; + /// Encodes the message to the writer + /// The allocator is used to generate submessages internally. + /// Hence, an ArenaAllocator is a preferred choice if allocations are a bottleneck. pub fn encode( self: @This(), writer: *std.Io.Writer, allocator: std.mem.Allocator, ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { - return pb.encode(writer, allocator, self); + return protobuf.encode(writer, allocator, self); } + /// Decodes the message from the bytes read from the reader. pub fn decode( reader: *std.Io.Reader, allocator: std.mem.Allocator, - ) (pb.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { - return pb.decode(@This(), reader, allocator); + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); } + /// Deinitializes and frees the memory associated with the message. pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { - return pb.deinit(allocator, self); + return protobuf.deinit(allocator, self); } + /// Duplicates the message. pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { - return pb.dupe(@This(), self, allocator); + return protobuf.dupe(@This(), self, allocator); } + /// Decodes the message from the JSON string. pub fn jsonDecode( input: []const u8, options: std.json.ParseOptions, allocator: std.mem.Allocator, ) !std.json.Parsed(@This()) { - return pb.json.decode(@This(), input, options, allocator); + return protobuf.json.decode(@This(), input, options, allocator); } + /// Encodes the message to a JSON string. pub fn jsonEncode( self: @This(), options: std.json.Stringify.Options, allocator: std.mem.Allocator, ) ![]const u8 { - return pb.json.encode(self, options, allocator); + return protobuf.json.encode(self, options, allocator); } - // This method is used by std.json - // internally for deserialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for deserialization. DO NOT RENAME! pub fn jsonParse( allocator: std.mem.Allocator, source: anytype, options: std.json.ParseOptions, ) !@This() { - return pb.json.parse(@This(), allocator, source, options); + return protobuf.json.parse(@This(), allocator, source, options); } - // This method is used by std.json - // internally for serialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for serialization. DO NOT RENAME! pub fn jsonStringify(self: *const @This(), jws: anytype) !void { - return pb.json.stringify(@This(), self, jws); + return protobuf.json.stringify(@This(), self, jws); } }; + /// Move a carrier to the desired position. + /// + /// Expected response: `mmc.Response.body.command.body.id` (uint32). pub const Move = struct { line: u32 = 0, carrier: u32 = 0, @@ -776,62 +888,73 @@ pub const Request = struct { .target = fd(null, .{ .oneof = target_union }), }; + /// Encodes the message to the writer + /// The allocator is used to generate submessages internally. + /// Hence, an ArenaAllocator is a preferred choice if allocations are a bottleneck. pub fn encode( self: @This(), writer: *std.Io.Writer, allocator: std.mem.Allocator, ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { - return pb.encode(writer, allocator, self); + return protobuf.encode(writer, allocator, self); } + /// Decodes the message from the bytes read from the reader. pub fn decode( reader: *std.Io.Reader, allocator: std.mem.Allocator, - ) (pb.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { - return pb.decode(@This(), reader, allocator); + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); } + /// Deinitializes and frees the memory associated with the message. pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { - return pb.deinit(allocator, self); + return protobuf.deinit(allocator, self); } + /// Duplicates the message. pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { - return pb.dupe(@This(), self, allocator); + return protobuf.dupe(@This(), self, allocator); } + /// Decodes the message from the JSON string. pub fn jsonDecode( input: []const u8, options: std.json.ParseOptions, allocator: std.mem.Allocator, ) !std.json.Parsed(@This()) { - return pb.json.decode(@This(), input, options, allocator); + return protobuf.json.decode(@This(), input, options, allocator); } + /// Encodes the message to a JSON string. pub fn jsonEncode( self: @This(), options: std.json.Stringify.Options, allocator: std.mem.Allocator, ) ![]const u8 { - return pb.json.encode(self, options, allocator); + return protobuf.json.encode(self, options, allocator); } - // This method is used by std.json - // internally for deserialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for deserialization. DO NOT RENAME! pub fn jsonParse( allocator: std.mem.Allocator, source: anytype, options: std.json.ParseOptions, ) !@This() { - return pb.json.parse(@This(), allocator, source, options); + return protobuf.json.parse(@This(), allocator, source, options); } - // This method is used by std.json - // internally for serialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for serialization. DO NOT RENAME! pub fn jsonStringify(self: *const @This(), jws: anytype) !void { - return pb.json.stringify(@This(), self, jws); + return protobuf.json.stringify(@This(), self, jws); } }; + /// Push an initialized carrier to the specified direction. + /// + /// Expected response: `mmc.Response.body.command.body.id` (uint32). pub const Push = struct { line: u32 = 0, axis: u32 = 0, @@ -851,62 +974,73 @@ pub const Request = struct { .velocity_mode = fd(7, .@"enum"), }; + /// Encodes the message to the writer + /// The allocator is used to generate submessages internally. + /// Hence, an ArenaAllocator is a preferred choice if allocations are a bottleneck. pub fn encode( self: @This(), writer: *std.Io.Writer, allocator: std.mem.Allocator, ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { - return pb.encode(writer, allocator, self); + return protobuf.encode(writer, allocator, self); } + /// Decodes the message from the bytes read from the reader. pub fn decode( reader: *std.Io.Reader, allocator: std.mem.Allocator, - ) (pb.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { - return pb.decode(@This(), reader, allocator); + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); } + /// Deinitializes and frees the memory associated with the message. pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { - return pb.deinit(allocator, self); + return protobuf.deinit(allocator, self); } + /// Duplicates the message. pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { - return pb.dupe(@This(), self, allocator); + return protobuf.dupe(@This(), self, allocator); } + /// Decodes the message from the JSON string. pub fn jsonDecode( input: []const u8, options: std.json.ParseOptions, allocator: std.mem.Allocator, ) !std.json.Parsed(@This()) { - return pb.json.decode(@This(), input, options, allocator); + return protobuf.json.decode(@This(), input, options, allocator); } + /// Encodes the message to a JSON string. pub fn jsonEncode( self: @This(), options: std.json.Stringify.Options, allocator: std.mem.Allocator, ) ![]const u8 { - return pb.json.encode(self, options, allocator); + return protobuf.json.encode(self, options, allocator); } - // This method is used by std.json - // internally for deserialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for deserialization. DO NOT RENAME! pub fn jsonParse( allocator: std.mem.Allocator, source: anytype, options: std.json.ParseOptions, ) !@This() { - return pb.json.parse(@This(), allocator, source, options); + return protobuf.json.parse(@This(), allocator, source, options); } - // This method is used by std.json - // internally for serialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for serialization. DO NOT RENAME! pub fn jsonStringify(self: *const @This(), jws: anytype) !void { - return pb.json.stringify(@This(), self, jws); + return protobuf.json.stringify(@This(), self, jws); } }; + /// Pull and initialize a new carrier into a line. + /// + /// Expected response: `mmc.Response.body.command.body.id` (uint32). pub const Pull = struct { line: u32 = 0, axis: u32 = 0, @@ -955,118 +1089,137 @@ pub const Request = struct { .target = fd(null, .{ .oneof = target_union }), }; + /// Encodes the message to the writer + /// The allocator is used to generate submessages internally. + /// Hence, an ArenaAllocator is a preferred choice if allocations are a bottleneck. pub fn encode( self: @This(), writer: *std.Io.Writer, allocator: std.mem.Allocator, ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { - return pb.encode(writer, allocator, self); + return protobuf.encode(writer, allocator, self); } + /// Decodes the message from the bytes read from the reader. pub fn decode( reader: *std.Io.Reader, allocator: std.mem.Allocator, - ) (pb.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { - return pb.decode(@This(), reader, allocator); + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); } + /// Deinitializes and frees the memory associated with the message. pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { - return pb.deinit(allocator, self); + return protobuf.deinit(allocator, self); } + /// Duplicates the message. pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { - return pb.dupe(@This(), self, allocator); + return protobuf.dupe(@This(), self, allocator); } + /// Decodes the message from the JSON string. pub fn jsonDecode( input: []const u8, options: std.json.ParseOptions, allocator: std.mem.Allocator, ) !std.json.Parsed(@This()) { - return pb.json.decode(@This(), input, options, allocator); + return protobuf.json.decode(@This(), input, options, allocator); } + /// Encodes the message to a JSON string. pub fn jsonEncode( self: @This(), options: std.json.Stringify.Options, allocator: std.mem.Allocator, ) ![]const u8 { - return pb.json.encode(self, options, allocator); + return protobuf.json.encode(self, options, allocator); } - // This method is used by std.json - // internally for deserialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for deserialization. DO NOT RENAME! pub fn jsonParse( allocator: std.mem.Allocator, source: anytype, options: std.json.ParseOptions, ) !@This() { - return pb.json.parse(@This(), allocator, source, options); + return protobuf.json.parse(@This(), allocator, source, options); } - // This method is used by std.json - // internally for serialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for serialization. DO NOT RENAME! pub fn jsonStringify(self: *const @This(), jws: anytype) !void { - return pb.json.stringify(@This(), self, jws); + return protobuf.json.stringify(@This(), self, jws); } }; + /// Encodes the message to the writer + /// The allocator is used to generate submessages internally. + /// Hence, an ArenaAllocator is a preferred choice if allocations are a bottleneck. pub fn encode( self: @This(), writer: *std.Io.Writer, allocator: std.mem.Allocator, ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { - return pb.encode(writer, allocator, self); + return protobuf.encode(writer, allocator, self); } + /// Decodes the message from the bytes read from the reader. pub fn decode( reader: *std.Io.Reader, allocator: std.mem.Allocator, - ) (pb.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { - return pb.decode(@This(), reader, allocator); + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); } + /// Deinitializes and frees the memory associated with the message. pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { - return pb.deinit(allocator, self); + return protobuf.deinit(allocator, self); } + /// Duplicates the message. pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { - return pb.dupe(@This(), self, allocator); + return protobuf.dupe(@This(), self, allocator); } + /// Decodes the message from the JSON string. pub fn jsonDecode( input: []const u8, options: std.json.ParseOptions, allocator: std.mem.Allocator, ) !std.json.Parsed(@This()) { - return pb.json.decode(@This(), input, options, allocator); + return protobuf.json.decode(@This(), input, options, allocator); } + /// Encodes the message to a JSON string. pub fn jsonEncode( self: @This(), options: std.json.Stringify.Options, allocator: std.mem.Allocator, ) ![]const u8 { - return pb.json.encode(self, options, allocator); + return protobuf.json.encode(self, options, allocator); } - // This method is used by std.json - // internally for deserialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for deserialization. DO NOT RENAME! pub fn jsonParse( allocator: std.mem.Allocator, source: anytype, options: std.json.ParseOptions, ) !@This() { - return pb.json.parse(@This(), allocator, source, options); + return protobuf.json.parse(@This(), allocator, source, options); } - // This method is used by std.json - // internally for serialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for serialization. DO NOT RENAME! pub fn jsonStringify(self: *const @This(), jws: anytype) !void { - return pb.json.stringify(@This(), self, jws); + return protobuf.json.stringify(@This(), self, jws); } }; + /// Initialize a carrier. + /// + /// Expected response: `mmc.Response.body.command.body.id` (uint32). pub const Initialize = struct { line: u32 = 0, axis: u32 = 0, @@ -1082,62 +1235,75 @@ pub const Request = struct { .link_axis = fd(5, .@"enum"), }; + /// Encodes the message to the writer + /// The allocator is used to generate submessages internally. + /// Hence, an ArenaAllocator is a preferred choice if allocations are a bottleneck. pub fn encode( self: @This(), writer: *std.Io.Writer, allocator: std.mem.Allocator, ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { - return pb.encode(writer, allocator, self); + return protobuf.encode(writer, allocator, self); } + /// Decodes the message from the bytes read from the reader. pub fn decode( reader: *std.Io.Reader, allocator: std.mem.Allocator, - ) (pb.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { - return pb.decode(@This(), reader, allocator); + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); } + /// Deinitializes and frees the memory associated with the message. pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { - return pb.deinit(allocator, self); + return protobuf.deinit(allocator, self); } + /// Duplicates the message. pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { - return pb.dupe(@This(), self, allocator); + return protobuf.dupe(@This(), self, allocator); } + /// Decodes the message from the JSON string. pub fn jsonDecode( input: []const u8, options: std.json.ParseOptions, allocator: std.mem.Allocator, ) !std.json.Parsed(@This()) { - return pb.json.decode(@This(), input, options, allocator); + return protobuf.json.decode(@This(), input, options, allocator); } + /// Encodes the message to a JSON string. pub fn jsonEncode( self: @This(), options: std.json.Stringify.Options, allocator: std.mem.Allocator, ) ![]const u8 { - return pb.json.encode(self, options, allocator); + return protobuf.json.encode(self, options, allocator); } - // This method is used by std.json - // internally for deserialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for deserialization. DO NOT RENAME! pub fn jsonParse( allocator: std.mem.Allocator, source: anytype, options: std.json.ParseOptions, ) !@This() { - return pb.json.parse(@This(), allocator, source, options); + return protobuf.json.parse(@This(), allocator, source, options); } - // This method is used by std.json - // internally for serialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for serialization. DO NOT RENAME! pub fn jsonStringify(self: *const @This(), jws: anytype) !void { - return pb.json.stringify(@This(), self, jws); + return protobuf.json.stringify(@This(), self, jws); } }; + /// Remove a command on the server if the command ID is specified. If no + /// command ID is specified, remove any commands received by the server. If + /// the commands are still progressing, cancel the command execution. + /// + /// Expected response: `mmc.Response.body.command.body.removed_id` (uint32). pub const RemoveCommand = struct { command: ?u32 = null, @@ -1145,62 +1311,74 @@ pub const Request = struct { .command = fd(1, .{ .scalar = .uint32 }), }; + /// Encodes the message to the writer + /// The allocator is used to generate submessages internally. + /// Hence, an ArenaAllocator is a preferred choice if allocations are a bottleneck. pub fn encode( self: @This(), writer: *std.Io.Writer, allocator: std.mem.Allocator, ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { - return pb.encode(writer, allocator, self); + return protobuf.encode(writer, allocator, self); } + /// Decodes the message from the bytes read from the reader. pub fn decode( reader: *std.Io.Reader, allocator: std.mem.Allocator, - ) (pb.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { - return pb.decode(@This(), reader, allocator); + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); } + /// Deinitializes and frees the memory associated with the message. pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { - return pb.deinit(allocator, self); + return protobuf.deinit(allocator, self); } + /// Duplicates the message. pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { - return pb.dupe(@This(), self, allocator); + return protobuf.dupe(@This(), self, allocator); } + /// Decodes the message from the JSON string. pub fn jsonDecode( input: []const u8, options: std.json.ParseOptions, allocator: std.mem.Allocator, ) !std.json.Parsed(@This()) { - return pb.json.decode(@This(), input, options, allocator); + return protobuf.json.decode(@This(), input, options, allocator); } + /// Encodes the message to a JSON string. pub fn jsonEncode( self: @This(), options: std.json.Stringify.Options, allocator: std.mem.Allocator, ) ![]const u8 { - return pb.json.encode(self, options, allocator); + return protobuf.json.encode(self, options, allocator); } - // This method is used by std.json - // internally for deserialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for deserialization. DO NOT RENAME! pub fn jsonParse( allocator: std.mem.Allocator, source: anytype, options: std.json.ParseOptions, ) !@This() { - return pb.json.parse(@This(), allocator, source, options); + return protobuf.json.parse(@This(), allocator, source, options); } - // This method is used by std.json - // internally for serialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for serialization. DO NOT RENAME! pub fn jsonStringify(self: *const @This(), jws: anytype) !void { - return pb.json.stringify(@This(), self, jws); + return protobuf.json.stringify(@This(), self, jws); } }; + /// Send an emergency stop command to stop any operation in PMF LMS. This + /// command also removes all queued commands in the server. + /// + /// Expected response: `mmc.Response.body.command.body.id` (uint32). pub const Stop = struct { lines: std.ArrayListUnmanaged(u32) = .empty, @@ -1208,62 +1386,74 @@ pub const Request = struct { .lines = fd(1, .{ .packed_repeated = .{ .scalar = .uint32 } }), }; + /// Encodes the message to the writer + /// The allocator is used to generate submessages internally. + /// Hence, an ArenaAllocator is a preferred choice if allocations are a bottleneck. pub fn encode( self: @This(), writer: *std.Io.Writer, allocator: std.mem.Allocator, ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { - return pb.encode(writer, allocator, self); + return protobuf.encode(writer, allocator, self); } + /// Decodes the message from the bytes read from the reader. pub fn decode( reader: *std.Io.Reader, allocator: std.mem.Allocator, - ) (pb.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { - return pb.decode(@This(), reader, allocator); + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); } + /// Deinitializes and frees the memory associated with the message. pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { - return pb.deinit(allocator, self); + return protobuf.deinit(allocator, self); } + /// Duplicates the message. pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { - return pb.dupe(@This(), self, allocator); + return protobuf.dupe(@This(), self, allocator); } + /// Decodes the message from the JSON string. pub fn jsonDecode( input: []const u8, options: std.json.ParseOptions, allocator: std.mem.Allocator, ) !std.json.Parsed(@This()) { - return pb.json.decode(@This(), input, options, allocator); + return protobuf.json.decode(@This(), input, options, allocator); } + /// Encodes the message to a JSON string. pub fn jsonEncode( self: @This(), options: std.json.Stringify.Options, allocator: std.mem.Allocator, ) ![]const u8 { - return pb.json.encode(self, options, allocator); + return protobuf.json.encode(self, options, allocator); } - // This method is used by std.json - // internally for deserialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for deserialization. DO NOT RENAME! pub fn jsonParse( allocator: std.mem.Allocator, source: anytype, options: std.json.ParseOptions, ) !@This() { - return pb.json.parse(@This(), allocator, source, options); + return protobuf.json.parse(@This(), allocator, source, options); } - // This method is used by std.json - // internally for serialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for serialization. DO NOT RENAME! pub fn jsonStringify(self: *const @This(), jws: anytype) !void { - return pb.json.stringify(@This(), self, jws); + return protobuf.json.stringify(@This(), self, jws); } }; + /// Pause any operation in PMF LMS. Any queued commands in the server will be + /// continued once the resume command is given. + /// + /// Expected response: `mmc.Response.body.command.body.id` (uint32). pub const Pause = struct { lines: std.ArrayListUnmanaged(u32) = .empty, @@ -1271,62 +1461,74 @@ pub const Request = struct { .lines = fd(1, .{ .packed_repeated = .{ .scalar = .uint32 } }), }; + /// Encodes the message to the writer + /// The allocator is used to generate submessages internally. + /// Hence, an ArenaAllocator is a preferred choice if allocations are a bottleneck. pub fn encode( self: @This(), writer: *std.Io.Writer, allocator: std.mem.Allocator, ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { - return pb.encode(writer, allocator, self); + return protobuf.encode(writer, allocator, self); } + /// Decodes the message from the bytes read from the reader. pub fn decode( reader: *std.Io.Reader, allocator: std.mem.Allocator, - ) (pb.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { - return pb.decode(@This(), reader, allocator); + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); } + /// Deinitializes and frees the memory associated with the message. pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { - return pb.deinit(allocator, self); + return protobuf.deinit(allocator, self); } + /// Duplicates the message. pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { - return pb.dupe(@This(), self, allocator); + return protobuf.dupe(@This(), self, allocator); } + /// Decodes the message from the JSON string. pub fn jsonDecode( input: []const u8, options: std.json.ParseOptions, allocator: std.mem.Allocator, ) !std.json.Parsed(@This()) { - return pb.json.decode(@This(), input, options, allocator); + return protobuf.json.decode(@This(), input, options, allocator); } + /// Encodes the message to a JSON string. pub fn jsonEncode( self: @This(), options: std.json.Stringify.Options, allocator: std.mem.Allocator, ) ![]const u8 { - return pb.json.encode(self, options, allocator); + return protobuf.json.encode(self, options, allocator); } - // This method is used by std.json - // internally for deserialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for deserialization. DO NOT RENAME! pub fn jsonParse( allocator: std.mem.Allocator, source: anytype, options: std.json.ParseOptions, ) !@This() { - return pb.json.parse(@This(), allocator, source, options); + return protobuf.json.parse(@This(), allocator, source, options); } - // This method is used by std.json - // internally for serialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for serialization. DO NOT RENAME! pub fn jsonStringify(self: *const @This(), jws: anytype) !void { - return pb.json.stringify(@This(), self, jws); + return protobuf.json.stringify(@This(), self, jws); } }; + /// Resume lines that have been stopped or paused. If the line is not paused + /// or emergency stopped, this command will succeed without any effect. + /// + /// Expected response: `mmc.Response.body.command.body.id` (uint32). pub const Resume = struct { lines: std.ArrayListUnmanaged(u32) = .empty, @@ -1334,62 +1536,74 @@ pub const Request = struct { .lines = fd(1, .{ .packed_repeated = .{ .scalar = .uint32 } }), }; + /// Encodes the message to the writer + /// The allocator is used to generate submessages internally. + /// Hence, an ArenaAllocator is a preferred choice if allocations are a bottleneck. pub fn encode( self: @This(), writer: *std.Io.Writer, allocator: std.mem.Allocator, ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { - return pb.encode(writer, allocator, self); + return protobuf.encode(writer, allocator, self); } + /// Decodes the message from the bytes read from the reader. pub fn decode( reader: *std.Io.Reader, allocator: std.mem.Allocator, - ) (pb.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { - return pb.decode(@This(), reader, allocator); + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); } + /// Deinitializes and frees the memory associated with the message. pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { - return pb.deinit(allocator, self); + return protobuf.deinit(allocator, self); } + /// Duplicates the message. pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { - return pb.dupe(@This(), self, allocator); + return protobuf.dupe(@This(), self, allocator); } + /// Decodes the message from the JSON string. pub fn jsonDecode( input: []const u8, options: std.json.ParseOptions, allocator: std.mem.Allocator, ) !std.json.Parsed(@This()) { - return pb.json.decode(@This(), input, options, allocator); + return protobuf.json.decode(@This(), input, options, allocator); } + /// Encodes the message to a JSON string. pub fn jsonEncode( self: @This(), options: std.json.Stringify.Options, allocator: std.mem.Allocator, ) ![]const u8 { - return pb.json.encode(self, options, allocator); + return protobuf.json.encode(self, options, allocator); } - // This method is used by std.json - // internally for deserialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for deserialization. DO NOT RENAME! pub fn jsonParse( allocator: std.mem.Allocator, source: anytype, options: std.json.ParseOptions, ) !@This() { - return pb.json.parse(@This(), allocator, source, options); + return protobuf.json.parse(@This(), allocator, source, options); } - // This method is used by std.json - // internally for serialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for serialization. DO NOT RENAME! pub fn jsonStringify(self: *const @This(), jws: anytype) !void { - return pb.json.stringify(@This(), self, jws); + return protobuf.json.stringify(@This(), self, jws); } }; + /// Change the carrier ID of an existing initialized carrier. If the new + /// carrier ID already exists on the line, returns INVALID_CARRIER. + /// + /// Expected response: `mmc.Response.body.command.body.id` (uint32). pub const SetCarrierId = struct { line: u32 = 0, carrier: u32 = 0, @@ -1401,118 +1615,135 @@ pub const Request = struct { .new_carrier = fd(3, .{ .scalar = .uint32 }), }; + /// Encodes the message to the writer + /// The allocator is used to generate submessages internally. + /// Hence, an ArenaAllocator is a preferred choice if allocations are a bottleneck. pub fn encode( self: @This(), writer: *std.Io.Writer, allocator: std.mem.Allocator, ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { - return pb.encode(writer, allocator, self); + return protobuf.encode(writer, allocator, self); } + /// Decodes the message from the bytes read from the reader. pub fn decode( reader: *std.Io.Reader, allocator: std.mem.Allocator, - ) (pb.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { - return pb.decode(@This(), reader, allocator); + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); } + /// Deinitializes and frees the memory associated with the message. pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { - return pb.deinit(allocator, self); + return protobuf.deinit(allocator, self); } + /// Duplicates the message. pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { - return pb.dupe(@This(), self, allocator); + return protobuf.dupe(@This(), self, allocator); } + /// Decodes the message from the JSON string. pub fn jsonDecode( input: []const u8, options: std.json.ParseOptions, allocator: std.mem.Allocator, ) !std.json.Parsed(@This()) { - return pb.json.decode(@This(), input, options, allocator); + return protobuf.json.decode(@This(), input, options, allocator); } + /// Encodes the message to a JSON string. pub fn jsonEncode( self: @This(), options: std.json.Stringify.Options, allocator: std.mem.Allocator, ) ![]const u8 { - return pb.json.encode(self, options, allocator); + return protobuf.json.encode(self, options, allocator); } - // This method is used by std.json - // internally for deserialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for deserialization. DO NOT RENAME! pub fn jsonParse( allocator: std.mem.Allocator, source: anytype, options: std.json.ParseOptions, ) !@This() { - return pb.json.parse(@This(), allocator, source, options); + return protobuf.json.parse(@This(), allocator, source, options); } - // This method is used by std.json - // internally for serialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for serialization. DO NOT RENAME! pub fn jsonStringify(self: *const @This(), jws: anytype) !void { - return pb.json.stringify(@This(), self, jws); + return protobuf.json.stringify(@This(), self, jws); } }; + /// Encodes the message to the writer + /// The allocator is used to generate submessages internally. + /// Hence, an ArenaAllocator is a preferred choice if allocations are a bottleneck. pub fn encode( self: @This(), writer: *std.Io.Writer, allocator: std.mem.Allocator, ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { - return pb.encode(writer, allocator, self); + return protobuf.encode(writer, allocator, self); } + /// Decodes the message from the bytes read from the reader. pub fn decode( reader: *std.Io.Reader, allocator: std.mem.Allocator, - ) (pb.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { - return pb.decode(@This(), reader, allocator); + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); } + /// Deinitializes and frees the memory associated with the message. pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { - return pb.deinit(allocator, self); + return protobuf.deinit(allocator, self); } + /// Duplicates the message. pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { - return pb.dupe(@This(), self, allocator); + return protobuf.dupe(@This(), self, allocator); } + /// Decodes the message from the JSON string. pub fn jsonDecode( input: []const u8, options: std.json.ParseOptions, allocator: std.mem.Allocator, ) !std.json.Parsed(@This()) { - return pb.json.decode(@This(), input, options, allocator); + return protobuf.json.decode(@This(), input, options, allocator); } + /// Encodes the message to a JSON string. pub fn jsonEncode( self: @This(), options: std.json.Stringify.Options, allocator: std.mem.Allocator, ) ![]const u8 { - return pb.json.encode(self, options, allocator); + return protobuf.json.encode(self, options, allocator); } - // This method is used by std.json - // internally for deserialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for deserialization. DO NOT RENAME! pub fn jsonParse( allocator: std.mem.Allocator, source: anytype, options: std.json.ParseOptions, ) !@This() { - return pb.json.parse(@This(), allocator, source, options); + return protobuf.json.parse(@This(), allocator, source, options); } - // This method is used by std.json - // internally for serialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for serialization. DO NOT RENAME! pub fn jsonStringify(self: *const @This(), jws: anytype) !void { - return pb.json.stringify(@This(), self, jws); + return protobuf.json.stringify(@This(), self, jws); } }; +/// Response description to the command API. pub const Response = struct { body: ?body_union = null, @@ -1536,58 +1767,66 @@ pub const Response = struct { .body = fd(null, .{ .oneof = body_union }), }; + /// Encodes the message to the writer + /// The allocator is used to generate submessages internally. + /// Hence, an ArenaAllocator is a preferred choice if allocations are a bottleneck. pub fn encode( self: @This(), writer: *std.Io.Writer, allocator: std.mem.Allocator, ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { - return pb.encode(writer, allocator, self); + return protobuf.encode(writer, allocator, self); } + /// Decodes the message from the bytes read from the reader. pub fn decode( reader: *std.Io.Reader, allocator: std.mem.Allocator, - ) (pb.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { - return pb.decode(@This(), reader, allocator); + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); } + /// Deinitializes and frees the memory associated with the message. pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { - return pb.deinit(allocator, self); + return protobuf.deinit(allocator, self); } + /// Duplicates the message. pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { - return pb.dupe(@This(), self, allocator); + return protobuf.dupe(@This(), self, allocator); } + /// Decodes the message from the JSON string. pub fn jsonDecode( input: []const u8, options: std.json.ParseOptions, allocator: std.mem.Allocator, ) !std.json.Parsed(@This()) { - return pb.json.decode(@This(), input, options, allocator); + return protobuf.json.decode(@This(), input, options, allocator); } + /// Encodes the message to a JSON string. pub fn jsonEncode( self: @This(), options: std.json.Stringify.Options, allocator: std.mem.Allocator, ) ![]const u8 { - return pb.json.encode(self, options, allocator); + return protobuf.json.encode(self, options, allocator); } - // This method is used by std.json - // internally for deserialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for deserialization. DO NOT RENAME! pub fn jsonParse( allocator: std.mem.Allocator, source: anytype, options: std.json.ParseOptions, ) !@This() { - return pb.json.parse(@This(), allocator, source, options); + return protobuf.json.parse(@This(), allocator, source, options); } - // This method is used by std.json - // internally for serialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for serialization. DO NOT RENAME! pub fn jsonStringify(self: *const @This(), jws: anytype) !void { - return pb.json.stringify(@This(), self, jws); + return protobuf.json.stringify(@This(), self, jws); } }; diff --git a/src/protobuf/mmc/core.pb.zig b/src/protobuf/mmc/core.pb.zig index 3392f3a..94447c1 100644 --- a/src/protobuf/mmc/core.pb.zig +++ b/src/protobuf/mmc/core.pb.zig @@ -2,8 +2,8 @@ ///! package mmc.core const std = @import("std"); -const pb = @import("protobuf"); -const fd = pb.fd; +const protobuf = @import("protobuf"); +const fd = protobuf.fd; pub const Request = struct { kind: Request.Kind = @enumFromInt(0), @@ -26,62 +26,71 @@ pub const Request = struct { _, }; + /// Encodes the message to the writer + /// The allocator is used to generate submessages internally. + /// Hence, an ArenaAllocator is a preferred choice if allocations are a bottleneck. pub fn encode( self: @This(), writer: *std.Io.Writer, allocator: std.mem.Allocator, ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { - return pb.encode(writer, allocator, self); + return protobuf.encode(writer, allocator, self); } + /// Decodes the message from the bytes read from the reader. pub fn decode( reader: *std.Io.Reader, allocator: std.mem.Allocator, - ) (pb.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { - return pb.decode(@This(), reader, allocator); + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); } + /// Deinitializes and frees the memory associated with the message. pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { - return pb.deinit(allocator, self); + return protobuf.deinit(allocator, self); } + /// Duplicates the message. pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { - return pb.dupe(@This(), self, allocator); + return protobuf.dupe(@This(), self, allocator); } + /// Decodes the message from the JSON string. pub fn jsonDecode( input: []const u8, options: std.json.ParseOptions, allocator: std.mem.Allocator, ) !std.json.Parsed(@This()) { - return pb.json.decode(@This(), input, options, allocator); + return protobuf.json.decode(@This(), input, options, allocator); } + /// Encodes the message to a JSON string. pub fn jsonEncode( self: @This(), options: std.json.Stringify.Options, allocator: std.mem.Allocator, ) ![]const u8 { - return pb.json.encode(self, options, allocator); + return protobuf.json.encode(self, options, allocator); } - // This method is used by std.json - // internally for deserialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for deserialization. DO NOT RENAME! pub fn jsonParse( allocator: std.mem.Allocator, source: anytype, options: std.json.ParseOptions, ) !@This() { - return pb.json.parse(@This(), allocator, source, options); + return protobuf.json.parse(@This(), allocator, source, options); } - // This method is used by std.json - // internally for serialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for serialization. DO NOT RENAME! pub fn jsonStringify(self: *const @This(), jws: anytype) !void { - return pb.json.stringify(@This(), self, jws); + return protobuf.json.stringify(@This(), self, jws); } }; +/// Response description to the core API. pub const Response = struct { body: ?body_union = null, @@ -132,115 +141,131 @@ pub const Response = struct { .drivers = fd(6, .{ .scalar = .uint32 }), }; + /// Encodes the message to the writer + /// The allocator is used to generate submessages internally. + /// Hence, an ArenaAllocator is a preferred choice if allocations are a bottleneck. pub fn encode( self: @This(), writer: *std.Io.Writer, allocator: std.mem.Allocator, ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { - return pb.encode(writer, allocator, self); + return protobuf.encode(writer, allocator, self); } + /// Decodes the message from the bytes read from the reader. pub fn decode( reader: *std.Io.Reader, allocator: std.mem.Allocator, - ) (pb.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { - return pb.decode(@This(), reader, allocator); + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); } + /// Deinitializes and frees the memory associated with the message. pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { - return pb.deinit(allocator, self); + return protobuf.deinit(allocator, self); } + /// Duplicates the message. pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { - return pb.dupe(@This(), self, allocator); + return protobuf.dupe(@This(), self, allocator); } + /// Decodes the message from the JSON string. pub fn jsonDecode( input: []const u8, options: std.json.ParseOptions, allocator: std.mem.Allocator, ) !std.json.Parsed(@This()) { - return pb.json.decode(@This(), input, options, allocator); + return protobuf.json.decode(@This(), input, options, allocator); } + /// Encodes the message to a JSON string. pub fn jsonEncode( self: @This(), options: std.json.Stringify.Options, allocator: std.mem.Allocator, ) ![]const u8 { - return pb.json.encode(self, options, allocator); + return protobuf.json.encode(self, options, allocator); } - // This method is used by std.json - // internally for deserialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for deserialization. DO NOT RENAME! pub fn jsonParse( allocator: std.mem.Allocator, source: anytype, options: std.json.ParseOptions, ) !@This() { - return pb.json.parse(@This(), allocator, source, options); + return protobuf.json.parse(@This(), allocator, source, options); } - // This method is used by std.json - // internally for serialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for serialization. DO NOT RENAME! pub fn jsonStringify(self: *const @This(), jws: anytype) !void { - return pb.json.stringify(@This(), self, jws); + return protobuf.json.stringify(@This(), self, jws); } }; + /// Encodes the message to the writer + /// The allocator is used to generate submessages internally. + /// Hence, an ArenaAllocator is a preferred choice if allocations are a bottleneck. pub fn encode( self: @This(), writer: *std.Io.Writer, allocator: std.mem.Allocator, ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { - return pb.encode(writer, allocator, self); + return protobuf.encode(writer, allocator, self); } + /// Decodes the message from the bytes read from the reader. pub fn decode( reader: *std.Io.Reader, allocator: std.mem.Allocator, - ) (pb.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { - return pb.decode(@This(), reader, allocator); + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); } + /// Deinitializes and frees the memory associated with the message. pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { - return pb.deinit(allocator, self); + return protobuf.deinit(allocator, self); } + /// Duplicates the message. pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { - return pb.dupe(@This(), self, allocator); + return protobuf.dupe(@This(), self, allocator); } + /// Decodes the message from the JSON string. pub fn jsonDecode( input: []const u8, options: std.json.ParseOptions, allocator: std.mem.Allocator, ) !std.json.Parsed(@This()) { - return pb.json.decode(@This(), input, options, allocator); + return protobuf.json.decode(@This(), input, options, allocator); } + /// Encodes the message to a JSON string. pub fn jsonEncode( self: @This(), options: std.json.Stringify.Options, allocator: std.mem.Allocator, ) ![]const u8 { - return pb.json.encode(self, options, allocator); + return protobuf.json.encode(self, options, allocator); } - // This method is used by std.json - // internally for deserialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for deserialization. DO NOT RENAME! pub fn jsonParse( allocator: std.mem.Allocator, source: anytype, options: std.json.ParseOptions, ) !@This() { - return pb.json.parse(@This(), allocator, source, options); + return protobuf.json.parse(@This(), allocator, source, options); } - // This method is used by std.json - // internally for serialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for serialization. DO NOT RENAME! pub fn jsonStringify(self: *const @This(), jws: anytype) !void { - return pb.json.stringify(@This(), self, jws); + return protobuf.json.stringify(@This(), self, jws); } }; @@ -255,62 +280,71 @@ pub const Response = struct { .patch = fd(3, .{ .scalar = .uint32 }), }; + /// Encodes the message to the writer + /// The allocator is used to generate submessages internally. + /// Hence, an ArenaAllocator is a preferred choice if allocations are a bottleneck. pub fn encode( self: @This(), writer: *std.Io.Writer, allocator: std.mem.Allocator, ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { - return pb.encode(writer, allocator, self); + return protobuf.encode(writer, allocator, self); } + /// Decodes the message from the bytes read from the reader. pub fn decode( reader: *std.Io.Reader, allocator: std.mem.Allocator, - ) (pb.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { - return pb.decode(@This(), reader, allocator); + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); } + /// Deinitializes and frees the memory associated with the message. pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { - return pb.deinit(allocator, self); + return protobuf.deinit(allocator, self); } + /// Duplicates the message. pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { - return pb.dupe(@This(), self, allocator); + return protobuf.dupe(@This(), self, allocator); } + /// Decodes the message from the JSON string. pub fn jsonDecode( input: []const u8, options: std.json.ParseOptions, allocator: std.mem.Allocator, ) !std.json.Parsed(@This()) { - return pb.json.decode(@This(), input, options, allocator); + return protobuf.json.decode(@This(), input, options, allocator); } + /// Encodes the message to a JSON string. pub fn jsonEncode( self: @This(), options: std.json.Stringify.Options, allocator: std.mem.Allocator, ) ![]const u8 { - return pb.json.encode(self, options, allocator); + return protobuf.json.encode(self, options, allocator); } - // This method is used by std.json - // internally for deserialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for deserialization. DO NOT RENAME! pub fn jsonParse( allocator: std.mem.Allocator, source: anytype, options: std.json.ParseOptions, ) !@This() { - return pb.json.parse(@This(), allocator, source, options); + return protobuf.json.parse(@This(), allocator, source, options); } - // This method is used by std.json - // internally for serialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for serialization. DO NOT RENAME! pub fn jsonStringify(self: *const @This(), jws: anytype) !void { - return pb.json.stringify(@This(), self, jws); + return protobuf.json.stringify(@This(), self, jws); } }; + /// Server version and name. pub const Server = struct { name: []const u8 = &.{}, version: ?Response.SemanticVersion = null, @@ -320,114 +354,130 @@ pub const Response = struct { .version = fd(2, .submessage), }; + /// Encodes the message to the writer + /// The allocator is used to generate submessages internally. + /// Hence, an ArenaAllocator is a preferred choice if allocations are a bottleneck. pub fn encode( self: @This(), writer: *std.Io.Writer, allocator: std.mem.Allocator, ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { - return pb.encode(writer, allocator, self); + return protobuf.encode(writer, allocator, self); } + /// Decodes the message from the bytes read from the reader. pub fn decode( reader: *std.Io.Reader, allocator: std.mem.Allocator, - ) (pb.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { - return pb.decode(@This(), reader, allocator); + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); } + /// Deinitializes and frees the memory associated with the message. pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { - return pb.deinit(allocator, self); + return protobuf.deinit(allocator, self); } + /// Duplicates the message. pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { - return pb.dupe(@This(), self, allocator); + return protobuf.dupe(@This(), self, allocator); } + /// Decodes the message from the JSON string. pub fn jsonDecode( input: []const u8, options: std.json.ParseOptions, allocator: std.mem.Allocator, ) !std.json.Parsed(@This()) { - return pb.json.decode(@This(), input, options, allocator); + return protobuf.json.decode(@This(), input, options, allocator); } + /// Encodes the message to a JSON string. pub fn jsonEncode( self: @This(), options: std.json.Stringify.Options, allocator: std.mem.Allocator, ) ![]const u8 { - return pb.json.encode(self, options, allocator); + return protobuf.json.encode(self, options, allocator); } - // This method is used by std.json - // internally for deserialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for deserialization. DO NOT RENAME! pub fn jsonParse( allocator: std.mem.Allocator, source: anytype, options: std.json.ParseOptions, ) !@This() { - return pb.json.parse(@This(), allocator, source, options); + return protobuf.json.parse(@This(), allocator, source, options); } - // This method is used by std.json - // internally for serialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for serialization. DO NOT RENAME! pub fn jsonStringify(self: *const @This(), jws: anytype) !void { - return pb.json.stringify(@This(), self, jws); + return protobuf.json.stringify(@This(), self, jws); } }; + /// Encodes the message to the writer + /// The allocator is used to generate submessages internally. + /// Hence, an ArenaAllocator is a preferred choice if allocations are a bottleneck. pub fn encode( self: @This(), writer: *std.Io.Writer, allocator: std.mem.Allocator, ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { - return pb.encode(writer, allocator, self); + return protobuf.encode(writer, allocator, self); } + /// Decodes the message from the bytes read from the reader. pub fn decode( reader: *std.Io.Reader, allocator: std.mem.Allocator, - ) (pb.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { - return pb.decode(@This(), reader, allocator); + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); } + /// Deinitializes and frees the memory associated with the message. pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { - return pb.deinit(allocator, self); + return protobuf.deinit(allocator, self); } + /// Duplicates the message. pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { - return pb.dupe(@This(), self, allocator); + return protobuf.dupe(@This(), self, allocator); } + /// Decodes the message from the JSON string. pub fn jsonDecode( input: []const u8, options: std.json.ParseOptions, allocator: std.mem.Allocator, ) !std.json.Parsed(@This()) { - return pb.json.decode(@This(), input, options, allocator); + return protobuf.json.decode(@This(), input, options, allocator); } + /// Encodes the message to a JSON string. pub fn jsonEncode( self: @This(), options: std.json.Stringify.Options, allocator: std.mem.Allocator, ) ![]const u8 { - return pb.json.encode(self, options, allocator); + return protobuf.json.encode(self, options, allocator); } - // This method is used by std.json - // internally for deserialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for deserialization. DO NOT RENAME! pub fn jsonParse( allocator: std.mem.Allocator, source: anytype, options: std.json.ParseOptions, ) !@This() { - return pb.json.parse(@This(), allocator, source, options); + return protobuf.json.parse(@This(), allocator, source, options); } - // This method is used by std.json - // internally for serialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for serialization. DO NOT RENAME! pub fn jsonStringify(self: *const @This(), jws: anytype) !void { - return pb.json.stringify(@This(), self, jws); + return protobuf.json.stringify(@This(), self, jws); } }; diff --git a/src/protobuf/mmc/info.pb.zig b/src/protobuf/mmc/info.pb.zig index 0705208..d6591d3 100644 --- a/src/protobuf/mmc/info.pb.zig +++ b/src/protobuf/mmc/info.pb.zig @@ -2,10 +2,10 @@ ///! package mmc.info const std = @import("std"); -const pb = @import("protobuf"); -const fd = pb.fd; -/// import package protobuf -const protobuf = @import("../protobuf.pb.zig"); +const protobuf = @import("protobuf"); +const fd = protobuf.fd; +/// import package mmc +const mmc = @import("../mmc.pb.zig"); pub const Request = struct { body: ?body_union = null, @@ -36,6 +36,10 @@ pub const Request = struct { _, }; + /// Request for status of specified command ID from the server. If no command + /// ID is provided, then request for status of all commands from the server. + /// + /// Expected response: `mmc.Response.body.info.body.commands` pub const Command = struct { id: ?u32 = null, @@ -43,62 +47,76 @@ pub const Request = struct { .id = fd(1, .{ .scalar = .uint32 }), }; + /// Encodes the message to the writer + /// The allocator is used to generate submessages internally. + /// Hence, an ArenaAllocator is a preferred choice if allocations are a bottleneck. pub fn encode( self: @This(), writer: *std.Io.Writer, allocator: std.mem.Allocator, ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { - return pb.encode(writer, allocator, self); + return protobuf.encode(writer, allocator, self); } + /// Decodes the message from the bytes read from the reader. pub fn decode( reader: *std.Io.Reader, allocator: std.mem.Allocator, - ) (pb.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { - return pb.decode(@This(), reader, allocator); + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); } + /// Deinitializes and frees the memory associated with the message. pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { - return pb.deinit(allocator, self); + return protobuf.deinit(allocator, self); } + /// Duplicates the message. pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { - return pb.dupe(@This(), self, allocator); + return protobuf.dupe(@This(), self, allocator); } + /// Decodes the message from the JSON string. pub fn jsonDecode( input: []const u8, options: std.json.ParseOptions, allocator: std.mem.Allocator, ) !std.json.Parsed(@This()) { - return pb.json.decode(@This(), input, options, allocator); + return protobuf.json.decode(@This(), input, options, allocator); } + /// Encodes the message to a JSON string. pub fn jsonEncode( self: @This(), options: std.json.Stringify.Options, allocator: std.mem.Allocator, ) ![]const u8 { - return pb.json.encode(self, options, allocator); + return protobuf.json.encode(self, options, allocator); } - // This method is used by std.json - // internally for deserialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for deserialization. DO NOT RENAME! pub fn jsonParse( allocator: std.mem.Allocator, source: anytype, options: std.json.ParseOptions, ) !@This() { - return pb.json.parse(@This(), allocator, source, options); + return protobuf.json.parse(@This(), allocator, source, options); } - // This method is used by std.json - // internally for serialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for serialization. DO NOT RENAME! pub fn jsonStringify(self: *const @This(), jws: anytype) !void { - return pb.json.stringify(@This(), self, jws); + return protobuf.json.stringify(@This(), self, jws); } }; + /// Request track state information from server. One or more of the `info_` + /// flags must be enabled to select the kind of track information desired. + /// A filter may be optionally provided to limit the source of information + /// from the track. + /// + /// Expected response: `mmc.Response.body.info.body.track` pub const Track = struct { line: u32 = 0, info_driver_state: bool = false, @@ -114,8 +132,8 @@ pub const Request = struct { carriers, }; pub const filter_union = union(_filter_case) { - drivers: protobuf.Range, - axes: protobuf.Range, + drivers: mmc.Range, + axes: mmc.Range, carriers: Request.Track.Ids, pub const _desc_table = .{ .drivers = fd(8, .submessage), @@ -134,6 +152,7 @@ pub const Request = struct { .filter = fd(null, .{ .oneof = filter_union }), }; + /// List of IDs. At least one ID must be provided. pub const Ids = struct { ids: std.ArrayListUnmanaged(u32) = .empty, @@ -141,171 +160,195 @@ pub const Request = struct { .ids = fd(1, .{ .packed_repeated = .{ .scalar = .uint32 } }), }; + /// Encodes the message to the writer + /// The allocator is used to generate submessages internally. + /// Hence, an ArenaAllocator is a preferred choice if allocations are a bottleneck. pub fn encode( self: @This(), writer: *std.Io.Writer, allocator: std.mem.Allocator, ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { - return pb.encode(writer, allocator, self); + return protobuf.encode(writer, allocator, self); } + /// Decodes the message from the bytes read from the reader. pub fn decode( reader: *std.Io.Reader, allocator: std.mem.Allocator, - ) (pb.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { - return pb.decode(@This(), reader, allocator); + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); } + /// Deinitializes and frees the memory associated with the message. pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { - return pb.deinit(allocator, self); + return protobuf.deinit(allocator, self); } + /// Duplicates the message. pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { - return pb.dupe(@This(), self, allocator); + return protobuf.dupe(@This(), self, allocator); } + /// Decodes the message from the JSON string. pub fn jsonDecode( input: []const u8, options: std.json.ParseOptions, allocator: std.mem.Allocator, ) !std.json.Parsed(@This()) { - return pb.json.decode(@This(), input, options, allocator); + return protobuf.json.decode(@This(), input, options, allocator); } + /// Encodes the message to a JSON string. pub fn jsonEncode( self: @This(), options: std.json.Stringify.Options, allocator: std.mem.Allocator, ) ![]const u8 { - return pb.json.encode(self, options, allocator); + return protobuf.json.encode(self, options, allocator); } - // This method is used by std.json - // internally for deserialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for deserialization. DO NOT RENAME! pub fn jsonParse( allocator: std.mem.Allocator, source: anytype, options: std.json.ParseOptions, ) !@This() { - return pb.json.parse(@This(), allocator, source, options); + return protobuf.json.parse(@This(), allocator, source, options); } - // This method is used by std.json - // internally for serialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for serialization. DO NOT RENAME! pub fn jsonStringify(self: *const @This(), jws: anytype) !void { - return pb.json.stringify(@This(), self, jws); + return protobuf.json.stringify(@This(), self, jws); } }; + /// Encodes the message to the writer + /// The allocator is used to generate submessages internally. + /// Hence, an ArenaAllocator is a preferred choice if allocations are a bottleneck. pub fn encode( self: @This(), writer: *std.Io.Writer, allocator: std.mem.Allocator, ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { - return pb.encode(writer, allocator, self); + return protobuf.encode(writer, allocator, self); } + /// Decodes the message from the bytes read from the reader. pub fn decode( reader: *std.Io.Reader, allocator: std.mem.Allocator, - ) (pb.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { - return pb.decode(@This(), reader, allocator); + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); } + /// Deinitializes and frees the memory associated with the message. pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { - return pb.deinit(allocator, self); + return protobuf.deinit(allocator, self); } + /// Duplicates the message. pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { - return pb.dupe(@This(), self, allocator); + return protobuf.dupe(@This(), self, allocator); } + /// Decodes the message from the JSON string. pub fn jsonDecode( input: []const u8, options: std.json.ParseOptions, allocator: std.mem.Allocator, ) !std.json.Parsed(@This()) { - return pb.json.decode(@This(), input, options, allocator); + return protobuf.json.decode(@This(), input, options, allocator); } + /// Encodes the message to a JSON string. pub fn jsonEncode( self: @This(), options: std.json.Stringify.Options, allocator: std.mem.Allocator, ) ![]const u8 { - return pb.json.encode(self, options, allocator); + return protobuf.json.encode(self, options, allocator); } - // This method is used by std.json - // internally for deserialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for deserialization. DO NOT RENAME! pub fn jsonParse( allocator: std.mem.Allocator, source: anytype, options: std.json.ParseOptions, ) !@This() { - return pb.json.parse(@This(), allocator, source, options); + return protobuf.json.parse(@This(), allocator, source, options); } - // This method is used by std.json - // internally for serialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for serialization. DO NOT RENAME! pub fn jsonStringify(self: *const @This(), jws: anytype) !void { - return pb.json.stringify(@This(), self, jws); + return protobuf.json.stringify(@This(), self, jws); } }; + /// Encodes the message to the writer + /// The allocator is used to generate submessages internally. + /// Hence, an ArenaAllocator is a preferred choice if allocations are a bottleneck. pub fn encode( self: @This(), writer: *std.Io.Writer, allocator: std.mem.Allocator, ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { - return pb.encode(writer, allocator, self); + return protobuf.encode(writer, allocator, self); } + /// Decodes the message from the bytes read from the reader. pub fn decode( reader: *std.Io.Reader, allocator: std.mem.Allocator, - ) (pb.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { - return pb.decode(@This(), reader, allocator); + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); } + /// Deinitializes and frees the memory associated with the message. pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { - return pb.deinit(allocator, self); + return protobuf.deinit(allocator, self); } + /// Duplicates the message. pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { - return pb.dupe(@This(), self, allocator); + return protobuf.dupe(@This(), self, allocator); } + /// Decodes the message from the JSON string. pub fn jsonDecode( input: []const u8, options: std.json.ParseOptions, allocator: std.mem.Allocator, ) !std.json.Parsed(@This()) { - return pb.json.decode(@This(), input, options, allocator); + return protobuf.json.decode(@This(), input, options, allocator); } + /// Encodes the message to a JSON string. pub fn jsonEncode( self: @This(), options: std.json.Stringify.Options, allocator: std.mem.Allocator, ) ![]const u8 { - return pb.json.encode(self, options, allocator); + return protobuf.json.encode(self, options, allocator); } - // This method is used by std.json - // internally for deserialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for deserialization. DO NOT RENAME! pub fn jsonParse( allocator: std.mem.Allocator, source: anytype, options: std.json.ParseOptions, ) !@This() { - return pb.json.parse(@This(), allocator, source, options); + return protobuf.json.parse(@This(), allocator, source, options); } - // This method is used by std.json - // internally for serialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for serialization. DO NOT RENAME! pub fn jsonStringify(self: *const @This(), jws: anytype) !void { - return pb.json.stringify(@This(), self, jws); + return protobuf.json.stringify(@This(), self, jws); } }; @@ -339,59 +382,67 @@ pub const Response = struct { .items = fd(1, .{ .repeated = .submessage }), }; + /// Encodes the message to the writer + /// The allocator is used to generate submessages internally. + /// Hence, an ArenaAllocator is a preferred choice if allocations are a bottleneck. pub fn encode( self: @This(), writer: *std.Io.Writer, allocator: std.mem.Allocator, ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { - return pb.encode(writer, allocator, self); + return protobuf.encode(writer, allocator, self); } + /// Decodes the message from the bytes read from the reader. pub fn decode( reader: *std.Io.Reader, allocator: std.mem.Allocator, - ) (pb.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { - return pb.decode(@This(), reader, allocator); + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); } + /// Deinitializes and frees the memory associated with the message. pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { - return pb.deinit(allocator, self); + return protobuf.deinit(allocator, self); } + /// Duplicates the message. pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { - return pb.dupe(@This(), self, allocator); + return protobuf.dupe(@This(), self, allocator); } + /// Decodes the message from the JSON string. pub fn jsonDecode( input: []const u8, options: std.json.ParseOptions, allocator: std.mem.Allocator, ) !std.json.Parsed(@This()) { - return pb.json.decode(@This(), input, options, allocator); + return protobuf.json.decode(@This(), input, options, allocator); } + /// Encodes the message to a JSON string. pub fn jsonEncode( self: @This(), options: std.json.Stringify.Options, allocator: std.mem.Allocator, ) ![]const u8 { - return pb.json.encode(self, options, allocator); + return protobuf.json.encode(self, options, allocator); } - // This method is used by std.json - // internally for deserialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for deserialization. DO NOT RENAME! pub fn jsonParse( allocator: std.mem.Allocator, source: anytype, options: std.json.ParseOptions, ) !@This() { - return pb.json.parse(@This(), allocator, source, options); + return protobuf.json.parse(@This(), allocator, source, options); } - // This method is used by std.json - // internally for serialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for serialization. DO NOT RENAME! pub fn jsonStringify(self: *const @This(), jws: anytype) !void { - return pb.json.stringify(@This(), self, jws); + return protobuf.json.stringify(@This(), self, jws); } }; @@ -428,59 +479,67 @@ pub const Response = struct { _, }; + /// Encodes the message to the writer + /// The allocator is used to generate submessages internally. + /// Hence, an ArenaAllocator is a preferred choice if allocations are a bottleneck. pub fn encode( self: @This(), writer: *std.Io.Writer, allocator: std.mem.Allocator, ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { - return pb.encode(writer, allocator, self); + return protobuf.encode(writer, allocator, self); } + /// Decodes the message from the bytes read from the reader. pub fn decode( reader: *std.Io.Reader, allocator: std.mem.Allocator, - ) (pb.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { - return pb.decode(@This(), reader, allocator); + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); } + /// Deinitializes and frees the memory associated with the message. pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { - return pb.deinit(allocator, self); + return protobuf.deinit(allocator, self); } + /// Duplicates the message. pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { - return pb.dupe(@This(), self, allocator); + return protobuf.dupe(@This(), self, allocator); } + /// Decodes the message from the JSON string. pub fn jsonDecode( input: []const u8, options: std.json.ParseOptions, allocator: std.mem.Allocator, ) !std.json.Parsed(@This()) { - return pb.json.decode(@This(), input, options, allocator); + return protobuf.json.decode(@This(), input, options, allocator); } + /// Encodes the message to a JSON string. pub fn jsonEncode( self: @This(), options: std.json.Stringify.Options, allocator: std.mem.Allocator, ) ![]const u8 { - return pb.json.encode(self, options, allocator); + return protobuf.json.encode(self, options, allocator); } - // This method is used by std.json - // internally for deserialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for deserialization. DO NOT RENAME! pub fn jsonParse( allocator: std.mem.Allocator, source: anytype, options: std.json.ParseOptions, ) !@This() { - return pb.json.parse(@This(), allocator, source, options); + return protobuf.json.parse(@This(), allocator, source, options); } - // This method is used by std.json - // internally for serialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for serialization. DO NOT RENAME! pub fn jsonStringify(self: *const @This(), jws: anytype) !void { - return pb.json.stringify(@This(), self, jws); + return protobuf.json.stringify(@This(), self, jws); } }; @@ -523,59 +582,67 @@ pub const Response = struct { .hall_alarm_front = fd(7, .{ .scalar = .bool }), }; + /// Encodes the message to the writer + /// The allocator is used to generate submessages internally. + /// Hence, an ArenaAllocator is a preferred choice if allocations are a bottleneck. pub fn encode( self: @This(), writer: *std.Io.Writer, allocator: std.mem.Allocator, ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { - return pb.encode(writer, allocator, self); + return protobuf.encode(writer, allocator, self); } + /// Decodes the message from the bytes read from the reader. pub fn decode( reader: *std.Io.Reader, allocator: std.mem.Allocator, - ) (pb.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { - return pb.decode(@This(), reader, allocator); + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); } + /// Deinitializes and frees the memory associated with the message. pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { - return pb.deinit(allocator, self); + return protobuf.deinit(allocator, self); } + /// Duplicates the message. pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { - return pb.dupe(@This(), self, allocator); + return protobuf.dupe(@This(), self, allocator); } + /// Decodes the message from the JSON string. pub fn jsonDecode( input: []const u8, options: std.json.ParseOptions, allocator: std.mem.Allocator, ) !std.json.Parsed(@This()) { - return pb.json.decode(@This(), input, options, allocator); + return protobuf.json.decode(@This(), input, options, allocator); } + /// Encodes the message to a JSON string. pub fn jsonEncode( self: @This(), options: std.json.Stringify.Options, allocator: std.mem.Allocator, ) ![]const u8 { - return pb.json.encode(self, options, allocator); + return protobuf.json.encode(self, options, allocator); } - // This method is used by std.json - // internally for deserialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for deserialization. DO NOT RENAME! pub fn jsonParse( allocator: std.mem.Allocator, source: anytype, options: std.json.ParseOptions, ) !@This() { - return pb.json.parse(@This(), allocator, source, options); + return protobuf.json.parse(@This(), allocator, source, options); } - // This method is used by std.json - // internally for serialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for serialization. DO NOT RENAME! pub fn jsonStringify(self: *const @This(), jws: anytype) !void { - return pb.json.stringify(@This(), self, jws); + return protobuf.json.stringify(@This(), self, jws); } }; @@ -588,115 +655,131 @@ pub const Response = struct { .overcurrent = fd(2, .{ .scalar = .bool }), }; + /// Encodes the message to the writer + /// The allocator is used to generate submessages internally. + /// Hence, an ArenaAllocator is a preferred choice if allocations are a bottleneck. pub fn encode( self: @This(), writer: *std.Io.Writer, allocator: std.mem.Allocator, ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { - return pb.encode(writer, allocator, self); + return protobuf.encode(writer, allocator, self); } + /// Decodes the message from the bytes read from the reader. pub fn decode( reader: *std.Io.Reader, allocator: std.mem.Allocator, - ) (pb.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { - return pb.decode(@This(), reader, allocator); + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); } + /// Deinitializes and frees the memory associated with the message. pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { - return pb.deinit(allocator, self); + return protobuf.deinit(allocator, self); } + /// Duplicates the message. pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { - return pb.dupe(@This(), self, allocator); + return protobuf.dupe(@This(), self, allocator); } + /// Decodes the message from the JSON string. pub fn jsonDecode( input: []const u8, options: std.json.ParseOptions, allocator: std.mem.Allocator, ) !std.json.Parsed(@This()) { - return pb.json.decode(@This(), input, options, allocator); + return protobuf.json.decode(@This(), input, options, allocator); } + /// Encodes the message to a JSON string. pub fn jsonEncode( self: @This(), options: std.json.Stringify.Options, allocator: std.mem.Allocator, ) ![]const u8 { - return pb.json.encode(self, options, allocator); + return protobuf.json.encode(self, options, allocator); } - // This method is used by std.json - // internally for deserialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for deserialization. DO NOT RENAME! pub fn jsonParse( allocator: std.mem.Allocator, source: anytype, options: std.json.ParseOptions, ) !@This() { - return pb.json.parse(@This(), allocator, source, options); + return protobuf.json.parse(@This(), allocator, source, options); } - // This method is used by std.json - // internally for serialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for serialization. DO NOT RENAME! pub fn jsonStringify(self: *const @This(), jws: anytype) !void { - return pb.json.stringify(@This(), self, jws); + return protobuf.json.stringify(@This(), self, jws); } }; + /// Encodes the message to the writer + /// The allocator is used to generate submessages internally. + /// Hence, an ArenaAllocator is a preferred choice if allocations are a bottleneck. pub fn encode( self: @This(), writer: *std.Io.Writer, allocator: std.mem.Allocator, ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { - return pb.encode(writer, allocator, self); + return protobuf.encode(writer, allocator, self); } + /// Decodes the message from the bytes read from the reader. pub fn decode( reader: *std.Io.Reader, allocator: std.mem.Allocator, - ) (pb.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { - return pb.decode(@This(), reader, allocator); + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); } + /// Deinitializes and frees the memory associated with the message. pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { - return pb.deinit(allocator, self); + return protobuf.deinit(allocator, self); } + /// Duplicates the message. pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { - return pb.dupe(@This(), self, allocator); + return protobuf.dupe(@This(), self, allocator); } + /// Decodes the message from the JSON string. pub fn jsonDecode( input: []const u8, options: std.json.ParseOptions, allocator: std.mem.Allocator, ) !std.json.Parsed(@This()) { - return pb.json.decode(@This(), input, options, allocator); + return protobuf.json.decode(@This(), input, options, allocator); } + /// Encodes the message to a JSON string. pub fn jsonEncode( self: @This(), options: std.json.Stringify.Options, allocator: std.mem.Allocator, ) ![]const u8 { - return pb.json.encode(self, options, allocator); + return protobuf.json.encode(self, options, allocator); } - // This method is used by std.json - // internally for deserialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for deserialization. DO NOT RENAME! pub fn jsonParse( allocator: std.mem.Allocator, source: anytype, options: std.json.ParseOptions, ) !@This() { - return pb.json.parse(@This(), allocator, source, options); + return protobuf.json.parse(@This(), allocator, source, options); } - // This method is used by std.json - // internally for serialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for serialization. DO NOT RENAME! pub fn jsonStringify(self: *const @This(), jws: anytype) !void { - return pb.json.stringify(@This(), self, jws); + return protobuf.json.stringify(@This(), self, jws); } }; @@ -720,59 +803,67 @@ pub const Response = struct { .paused = fd(6, .{ .scalar = .bool }), }; + /// Encodes the message to the writer + /// The allocator is used to generate submessages internally. + /// Hence, an ArenaAllocator is a preferred choice if allocations are a bottleneck. pub fn encode( self: @This(), writer: *std.Io.Writer, allocator: std.mem.Allocator, ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { - return pb.encode(writer, allocator, self); + return protobuf.encode(writer, allocator, self); } + /// Decodes the message from the bytes read from the reader. pub fn decode( reader: *std.Io.Reader, allocator: std.mem.Allocator, - ) (pb.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { - return pb.decode(@This(), reader, allocator); + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); } + /// Deinitializes and frees the memory associated with the message. pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { - return pb.deinit(allocator, self); + return protobuf.deinit(allocator, self); } + /// Duplicates the message. pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { - return pb.dupe(@This(), self, allocator); + return protobuf.dupe(@This(), self, allocator); } + /// Decodes the message from the JSON string. pub fn jsonDecode( input: []const u8, options: std.json.ParseOptions, allocator: std.mem.Allocator, ) !std.json.Parsed(@This()) { - return pb.json.decode(@This(), input, options, allocator); + return protobuf.json.decode(@This(), input, options, allocator); } + /// Encodes the message to a JSON string. pub fn jsonEncode( self: @This(), options: std.json.Stringify.Options, allocator: std.mem.Allocator, ) ![]const u8 { - return pb.json.encode(self, options, allocator); + return protobuf.json.encode(self, options, allocator); } - // This method is used by std.json - // internally for deserialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for deserialization. DO NOT RENAME! pub fn jsonParse( allocator: std.mem.Allocator, source: anytype, options: std.json.ParseOptions, ) !@This() { - return pb.json.parse(@This(), allocator, source, options); + return protobuf.json.parse(@This(), allocator, source, options); } - // This method is used by std.json - // internally for serialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for serialization. DO NOT RENAME! pub fn jsonStringify(self: *const @This(), jws: anytype) !void { - return pb.json.stringify(@This(), self, jws); + return protobuf.json.stringify(@This(), self, jws); } }; @@ -795,115 +886,131 @@ pub const Response = struct { .comm_error_next = fd(7, .{ .scalar = .bool }), }; + /// Encodes the message to the writer + /// The allocator is used to generate submessages internally. + /// Hence, an ArenaAllocator is a preferred choice if allocations are a bottleneck. pub fn encode( self: @This(), writer: *std.Io.Writer, allocator: std.mem.Allocator, ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { - return pb.encode(writer, allocator, self); + return protobuf.encode(writer, allocator, self); } + /// Decodes the message from the bytes read from the reader. pub fn decode( reader: *std.Io.Reader, allocator: std.mem.Allocator, - ) (pb.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { - return pb.decode(@This(), reader, allocator); + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); } + /// Deinitializes and frees the memory associated with the message. pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { - return pb.deinit(allocator, self); + return protobuf.deinit(allocator, self); } + /// Duplicates the message. pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { - return pb.dupe(@This(), self, allocator); + return protobuf.dupe(@This(), self, allocator); } + /// Decodes the message from the JSON string. pub fn jsonDecode( input: []const u8, options: std.json.ParseOptions, allocator: std.mem.Allocator, ) !std.json.Parsed(@This()) { - return pb.json.decode(@This(), input, options, allocator); + return protobuf.json.decode(@This(), input, options, allocator); } + /// Encodes the message to a JSON string. pub fn jsonEncode( self: @This(), options: std.json.Stringify.Options, allocator: std.mem.Allocator, ) ![]const u8 { - return pb.json.encode(self, options, allocator); + return protobuf.json.encode(self, options, allocator); } - // This method is used by std.json - // internally for deserialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for deserialization. DO NOT RENAME! pub fn jsonParse( allocator: std.mem.Allocator, source: anytype, options: std.json.ParseOptions, ) !@This() { - return pb.json.parse(@This(), allocator, source, options); + return protobuf.json.parse(@This(), allocator, source, options); } - // This method is used by std.json - // internally for serialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for serialization. DO NOT RENAME! pub fn jsonStringify(self: *const @This(), jws: anytype) !void { - return pb.json.stringify(@This(), self, jws); + return protobuf.json.stringify(@This(), self, jws); } }; + /// Encodes the message to the writer + /// The allocator is used to generate submessages internally. + /// Hence, an ArenaAllocator is a preferred choice if allocations are a bottleneck. pub fn encode( self: @This(), writer: *std.Io.Writer, allocator: std.mem.Allocator, ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { - return pb.encode(writer, allocator, self); + return protobuf.encode(writer, allocator, self); } + /// Decodes the message from the bytes read from the reader. pub fn decode( reader: *std.Io.Reader, allocator: std.mem.Allocator, - ) (pb.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { - return pb.decode(@This(), reader, allocator); + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); } + /// Deinitializes and frees the memory associated with the message. pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { - return pb.deinit(allocator, self); + return protobuf.deinit(allocator, self); } + /// Duplicates the message. pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { - return pb.dupe(@This(), self, allocator); + return protobuf.dupe(@This(), self, allocator); } + /// Decodes the message from the JSON string. pub fn jsonDecode( input: []const u8, options: std.json.ParseOptions, allocator: std.mem.Allocator, ) !std.json.Parsed(@This()) { - return pb.json.decode(@This(), input, options, allocator); + return protobuf.json.decode(@This(), input, options, allocator); } + /// Encodes the message to a JSON string. pub fn jsonEncode( self: @This(), options: std.json.Stringify.Options, allocator: std.mem.Allocator, ) ![]const u8 { - return pb.json.encode(self, options, allocator); + return protobuf.json.encode(self, options, allocator); } - // This method is used by std.json - // internally for deserialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for deserialization. DO NOT RENAME! pub fn jsonParse( allocator: std.mem.Allocator, source: anytype, options: std.json.ParseOptions, ) !@This() { - return pb.json.parse(@This(), allocator, source, options); + return protobuf.json.parse(@This(), allocator, source, options); } - // This method is used by std.json - // internally for serialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for serialization. DO NOT RENAME! pub fn jsonStringify(self: *const @This(), jws: anytype) !void { - return pb.json.stringify(@This(), self, jws); + return protobuf.json.stringify(@This(), self, jws); } }; @@ -945,226 +1052,258 @@ pub const Response = struct { _, }; + /// Encodes the message to the writer + /// The allocator is used to generate submessages internally. + /// Hence, an ArenaAllocator is a preferred choice if allocations are a bottleneck. pub fn encode( self: @This(), writer: *std.Io.Writer, allocator: std.mem.Allocator, ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { - return pb.encode(writer, allocator, self); + return protobuf.encode(writer, allocator, self); } + /// Decodes the message from the bytes read from the reader. pub fn decode( reader: *std.Io.Reader, allocator: std.mem.Allocator, - ) (pb.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { - return pb.decode(@This(), reader, allocator); + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); } + /// Deinitializes and frees the memory associated with the message. pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { - return pb.deinit(allocator, self); + return protobuf.deinit(allocator, self); } + /// Duplicates the message. pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { - return pb.dupe(@This(), self, allocator); + return protobuf.dupe(@This(), self, allocator); } + /// Decodes the message from the JSON string. pub fn jsonDecode( input: []const u8, options: std.json.ParseOptions, allocator: std.mem.Allocator, ) !std.json.Parsed(@This()) { - return pb.json.decode(@This(), input, options, allocator); + return protobuf.json.decode(@This(), input, options, allocator); } + /// Encodes the message to a JSON string. pub fn jsonEncode( self: @This(), options: std.json.Stringify.Options, allocator: std.mem.Allocator, ) ![]const u8 { - return pb.json.encode(self, options, allocator); + return protobuf.json.encode(self, options, allocator); } - // This method is used by std.json - // internally for deserialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for deserialization. DO NOT RENAME! pub fn jsonParse( allocator: std.mem.Allocator, source: anytype, options: std.json.ParseOptions, ) !@This() { - return pb.json.parse(@This(), allocator, source, options); + return protobuf.json.parse(@This(), allocator, source, options); } - // This method is used by std.json - // internally for serialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for serialization. DO NOT RENAME! pub fn jsonStringify(self: *const @This(), jws: anytype) !void { - return pb.json.stringify(@This(), self, jws); + return protobuf.json.stringify(@This(), self, jws); } }; + /// Encodes the message to the writer + /// The allocator is used to generate submessages internally. + /// Hence, an ArenaAllocator is a preferred choice if allocations are a bottleneck. pub fn encode( self: @This(), writer: *std.Io.Writer, allocator: std.mem.Allocator, ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { - return pb.encode(writer, allocator, self); + return protobuf.encode(writer, allocator, self); } + /// Decodes the message from the bytes read from the reader. pub fn decode( reader: *std.Io.Reader, allocator: std.mem.Allocator, - ) (pb.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { - return pb.decode(@This(), reader, allocator); + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); } + /// Deinitializes and frees the memory associated with the message. pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { - return pb.deinit(allocator, self); + return protobuf.deinit(allocator, self); } + /// Duplicates the message. pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { - return pb.dupe(@This(), self, allocator); + return protobuf.dupe(@This(), self, allocator); } + /// Decodes the message from the JSON string. pub fn jsonDecode( input: []const u8, options: std.json.ParseOptions, allocator: std.mem.Allocator, ) !std.json.Parsed(@This()) { - return pb.json.decode(@This(), input, options, allocator); + return protobuf.json.decode(@This(), input, options, allocator); } + /// Encodes the message to a JSON string. pub fn jsonEncode( self: @This(), options: std.json.Stringify.Options, allocator: std.mem.Allocator, ) ![]const u8 { - return pb.json.encode(self, options, allocator); + return protobuf.json.encode(self, options, allocator); } - // This method is used by std.json - // internally for deserialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for deserialization. DO NOT RENAME! pub fn jsonParse( allocator: std.mem.Allocator, source: anytype, options: std.json.ParseOptions, ) !@This() { - return pb.json.parse(@This(), allocator, source, options); + return protobuf.json.parse(@This(), allocator, source, options); } - // This method is used by std.json - // internally for serialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for serialization. DO NOT RENAME! pub fn jsonStringify(self: *const @This(), jws: anytype) !void { - return pb.json.stringify(@This(), self, jws); + return protobuf.json.stringify(@This(), self, jws); } }; + /// Encodes the message to the writer + /// The allocator is used to generate submessages internally. + /// Hence, an ArenaAllocator is a preferred choice if allocations are a bottleneck. pub fn encode( self: @This(), writer: *std.Io.Writer, allocator: std.mem.Allocator, ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { - return pb.encode(writer, allocator, self); + return protobuf.encode(writer, allocator, self); } + /// Decodes the message from the bytes read from the reader. pub fn decode( reader: *std.Io.Reader, allocator: std.mem.Allocator, - ) (pb.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { - return pb.decode(@This(), reader, allocator); + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); } + /// Deinitializes and frees the memory associated with the message. pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { - return pb.deinit(allocator, self); + return protobuf.deinit(allocator, self); } + /// Duplicates the message. pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { - return pb.dupe(@This(), self, allocator); + return protobuf.dupe(@This(), self, allocator); } + /// Decodes the message from the JSON string. pub fn jsonDecode( input: []const u8, options: std.json.ParseOptions, allocator: std.mem.Allocator, ) !std.json.Parsed(@This()) { - return pb.json.decode(@This(), input, options, allocator); + return protobuf.json.decode(@This(), input, options, allocator); } + /// Encodes the message to a JSON string. pub fn jsonEncode( self: @This(), options: std.json.Stringify.Options, allocator: std.mem.Allocator, ) ![]const u8 { - return pb.json.encode(self, options, allocator); + return protobuf.json.encode(self, options, allocator); } - // This method is used by std.json - // internally for deserialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for deserialization. DO NOT RENAME! pub fn jsonParse( allocator: std.mem.Allocator, source: anytype, options: std.json.ParseOptions, ) !@This() { - return pb.json.parse(@This(), allocator, source, options); + return protobuf.json.parse(@This(), allocator, source, options); } - // This method is used by std.json - // internally for serialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for serialization. DO NOT RENAME! pub fn jsonStringify(self: *const @This(), jws: anytype) !void { - return pb.json.stringify(@This(), self, jws); + return protobuf.json.stringify(@This(), self, jws); } }; + /// Encodes the message to the writer + /// The allocator is used to generate submessages internally. + /// Hence, an ArenaAllocator is a preferred choice if allocations are a bottleneck. pub fn encode( self: @This(), writer: *std.Io.Writer, allocator: std.mem.Allocator, ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { - return pb.encode(writer, allocator, self); + return protobuf.encode(writer, allocator, self); } + /// Decodes the message from the bytes read from the reader. pub fn decode( reader: *std.Io.Reader, allocator: std.mem.Allocator, - ) (pb.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { - return pb.decode(@This(), reader, allocator); + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); } + /// Deinitializes and frees the memory associated with the message. pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { - return pb.deinit(allocator, self); + return protobuf.deinit(allocator, self); } + /// Duplicates the message. pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { - return pb.dupe(@This(), self, allocator); + return protobuf.dupe(@This(), self, allocator); } + /// Decodes the message from the JSON string. pub fn jsonDecode( input: []const u8, options: std.json.ParseOptions, allocator: std.mem.Allocator, ) !std.json.Parsed(@This()) { - return pb.json.decode(@This(), input, options, allocator); + return protobuf.json.decode(@This(), input, options, allocator); } + /// Encodes the message to a JSON string. pub fn jsonEncode( self: @This(), options: std.json.Stringify.Options, allocator: std.mem.Allocator, ) ![]const u8 { - return pb.json.encode(self, options, allocator); + return protobuf.json.encode(self, options, allocator); } - // This method is used by std.json - // internally for deserialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for deserialization. DO NOT RENAME! pub fn jsonParse( allocator: std.mem.Allocator, source: anytype, options: std.json.ParseOptions, ) !@This() { - return pb.json.parse(@This(), allocator, source, options); + return protobuf.json.parse(@This(), allocator, source, options); } - // This method is used by std.json - // internally for serialization. DO NOT RENAME! + /// This method is used by std.json + /// internally for serialization. DO NOT RENAME! pub fn jsonStringify(self: *const @This(), jws: anytype) !void { - return pb.json.stringify(@This(), self, jws); + return protobuf.json.stringify(@This(), self, jws); } };