Compare commits

..

No commits in common. "78c9c1292c683478d8ac98d8318bc098442cc0b9" and "d884d8ba59aeff1bafb0b66e4ddc1a23c24c6b24" have entirely different histories.

9 changed files with 67 additions and 91 deletions

View file

@ -40,8 +40,8 @@ pub fn build(b: *std.Build) void {
.optimize = optimize, .optimize = optimize,
}); });
if (tracy_enabled) { if (tracy_enabled) {
lib.root_module.addCMacro("TRACY_ENABLE", "1"); lib.defineCMacro("TRACY_ENABLE", null);
lib.root_module.addCMacro("TRACY_CALLSTACK", "1"); lib.defineCMacro("TRACY_CALLSTACK", null);
} }
lib.addIncludePath(b.path("src")); lib.addIncludePath(b.path("src"));
lib.addIncludePath(b.path("include")); lib.addIncludePath(b.path("include"));

View file

@ -1 +1 @@
0.14.0 0.13.0

View file

@ -1,16 +1,15 @@
.{ .{
.name = .thespian, .name = "thespian",
.version = "0.0.1", .version = "0.0.1",
.fingerprint = 0xe9ff00fd8e4e01a3,
.dependencies = .{ .dependencies = .{
.asio = .{ .asio = .{
.url = "https://github.com/neurocyte/asio/archive/24d28864ec5aae6146d88a172288e3bf3f099734.tar.gz", .url = "https://github.com/neurocyte/asio/archive/b9c9c23ef2e6f11b6123535ec33e5a23ed0c59da.tar.gz",
.hash = "asio-1.30.2-tLhDdyKA4QBqQFDrsuK_hO1HfqX-DQMl-Sku7yy4vUfM", .hash = "1220c85e0d9438ec518849c84e3ea66633a0e191e49c4ae4bbb3bc46626cd8dfad75",
}, },
.tracy = .{ .tracy = .{
.url = "https://github.com/neurocyte/zig-tracy/archive/f2fe3021501c19816006ab65e3389b1c5f0c3c3a.tar.gz", .url = "https://github.com/neurocyte/zig-tracy/archive/e04e31c64498149a324491b8534758e6af43a5c2.tar.gz",
.hash = "zig_tracy-0.0.3-5-cp3Kp2AABlufxcWskNe6YfKeqCRpDu7b57JvE-Yj1w", .hash = "1220d0fb2bff7b453dbb39d1db3eb472b6680e2564f2b23b0e947671be47bbdd188f",
}, },
}, },
.paths = .{ .paths = .{

View file

@ -209,12 +209,12 @@ fn writeErrorset(writer: anytype, err: anyerror) @TypeOf(writer).Error!void {
pub fn writeValue(writer: anytype, value: anytype) @TypeOf(writer).Error!void { pub fn writeValue(writer: anytype, value: anytype) @TypeOf(writer).Error!void {
const T = @TypeOf(value); const T = @TypeOf(value);
switch (@typeInfo(T)) { switch (@typeInfo(T)) {
.int, .comptime_int => return if (T == u64) writeU64(writer, value) else writeI64(writer, @intCast(value)), .Int, .ComptimeInt => return if (T == u64) writeU64(writer, value) else writeI64(writer, @intCast(value)),
.bool => return writeBool(writer, value), .Bool => return writeBool(writer, value),
.optional => return if (value) |v| writeValue(writer, v) else writeNull(writer), .Optional => return if (value) |v| writeValue(writer, v) else writeNull(writer),
.error_union => return if (value) |v| writeValue(writer, v) else |err| writeValue(writer, err), .ErrorUnion => return if (value) |v| writeValue(writer, v) else |err| writeValue(writer, err),
.error_set => return writeErrorset(writer, value), .ErrorSet => return writeErrorset(writer, value),
.@"union" => |info| { .Union => |info| {
if (info.tag_type) |TagType| { if (info.tag_type) |TagType| {
comptime var v = void; comptime var v = void;
inline for (info.fields) |u_field| { inline for (info.fields) |u_field| {
@ -230,7 +230,7 @@ pub fn writeValue(writer: anytype, value: anytype) @TypeOf(writer).Error!void {
try writeArray(writer, .{@typeName(T)}); try writeArray(writer, .{@typeName(T)});
} }
}, },
.@"struct" => |info| { .Struct => |info| {
if (info.is_tuple) { if (info.is_tuple) {
if (info.fields.len == 0) return writeNull(writer); if (info.fields.len == 0) return writeNull(writer);
try writeArrayHeader(writer, info.fields.len); try writeArrayHeader(writer, info.fields.len);
@ -245,10 +245,10 @@ pub fn writeValue(writer: anytype, value: anytype) @TypeOf(writer).Error!void {
} }
} }
}, },
.pointer => |ptr_info| switch (ptr_info.size) { .Pointer => |ptr_info| switch (ptr_info.size) {
.one => return writeValue(writer, value.*), .One => return writeValue(writer, value.*),
.many, .c => @compileError("cannot write type '" ++ @typeName(T) ++ "' to cbor stream"), .Many, .C => @compileError("cannot write type '" ++ @typeName(T) ++ "' to cbor stream"),
.slice => { .Slice => {
if (ptr_info.child == u8) return writeString(writer, value); if (ptr_info.child == u8) return writeString(writer, value);
if (value.len == 0) return writeNull(writer); if (value.len == 0) return writeNull(writer);
try writeArrayHeader(writer, value.len); try writeArrayHeader(writer, value.len);
@ -256,22 +256,22 @@ pub fn writeValue(writer: anytype, value: anytype) @TypeOf(writer).Error!void {
try writeValue(writer, elem); try writeValue(writer, elem);
}, },
}, },
.array => |info| { .Array => |info| {
if (info.child == u8) return writeString(writer, &value); if (info.child == u8) return writeString(writer, &value);
if (value.len == 0) return writeNull(writer); if (value.len == 0) return writeNull(writer);
try writeArrayHeader(writer, value.len); try writeArrayHeader(writer, value.len);
for (value) |elem| for (value) |elem|
try writeValue(writer, elem); try writeValue(writer, elem);
}, },
.vector => |info| { .Vector => |info| {
try writeArrayHeader(writer, info.len); try writeArrayHeader(writer, info.len);
var i: usize = 0; var i: usize = 0;
while (i < info.len) : (i += 1) { while (i < info.len) : (i += 1) {
try writeValue(writer, value[i]); try writeValue(writer, value[i]);
} }
}, },
.null => try writeNull(writer), .Null => try writeNull(writer),
.float => |info| switch (info.bits) { .Float => |info| switch (info.bits) {
16 => try writeF16(writer, value), 16 => try writeF16(writer, value),
32 => try writeF32(writer, value), 32 => try writeF32(writer, value),
64 => try writeF64(writer, value), 64 => try writeF64(writer, value),
@ -380,7 +380,7 @@ fn decodeJsonObject(iter_: *[]const u8, minor: u5, obj: *json.ObjectMap) Error!b
var iter = iter_.*; var iter = iter_.*;
var n = try decodePInt(&iter, minor); var n = try decodePInt(&iter, minor);
while (n > 0) { while (n > 0) {
var key: []const u8 = undefined; var key: []u8 = undefined;
var value: json.Value = .null; var value: json.Value = .null;
if (!try matchString(&iter, &key)) if (!try matchString(&iter, &key))
@ -522,21 +522,6 @@ fn matchFloatValue(comptime T: type, iter: *[]const u8, val: T) Error!bool {
return if (try matchFloat(T, iter, &v)) v == val else false; return if (try matchFloat(T, iter, &v)) v == val else false;
} }
pub fn matchEnum(comptime T: type, iter_: *[]const u8, val: *T) Error!bool {
var iter = iter_.*;
var str: []const u8 = undefined;
if (try matchString(&iter, &str)) if (std.meta.stringToEnum(T, str)) |val_| {
val.* = val_;
iter_.* = iter;
return true;
};
return false;
}
fn matchEnumValue(comptime T: type, iter: *[]const u8, val: T) Error!bool {
return matchStringValue(iter, @tagName(val));
}
fn skipString(iter: *[]const u8, minor: u5) Error!void { fn skipString(iter: *[]const u8, minor: u5) Error!void {
const len: usize = @intCast(try decodePInt(iter, minor)); const len: usize = @intCast(try decodePInt(iter, minor));
if (iter.len < len) if (iter.len < len)
@ -657,22 +642,21 @@ pub fn matchValue(iter: *[]const u8, value: anytype) Error!bool {
if (comptime isExtractor(T)) if (comptime isExtractor(T))
return value.extract(iter); return value.extract(iter);
return switch (comptime @typeInfo(T)) { return switch (comptime @typeInfo(T)) {
.int => return matchIntValue(T, iter, value), .Int => return matchIntValue(T, iter, value),
.comptime_int => return matchIntValue(i64, iter, value), .ComptimeInt => return matchIntValue(i64, iter, value),
.bool => matchBoolValue(iter, value), .Bool => matchBoolValue(iter, value),
.pointer => |info| switch (info.size) { .Pointer => |info| switch (info.size) {
.one => matchValue(iter, value.*), .One => matchValue(iter, value.*),
.many, .c => matchError(T), .Many, .C => matchError(T),
.slice => if (info.child == u8) matchStringValue(iter, value) else matchArray(iter, value, info), .Slice => if (info.child == u8) matchStringValue(iter, value) else matchArray(iter, value, info),
}, },
.@"struct" => |info| if (info.is_tuple) .Struct => |info| if (info.is_tuple)
matchArray(iter, value, info) matchArray(iter, value, info)
else else
matchError(T), matchError(T),
.array => |info| if (info.child == u8) matchStringValue(iter, &value) else matchArray(iter, value, info), .Array => |info| if (info.child == u8) matchStringValue(iter, &value) else matchArray(iter, value, info),
.float => matchFloatValue(T, iter, value), .Float => return matchFloatValue(T, iter, value),
.comptime_float => matchFloatValue(f64, iter, value), .ComptimeFloat => matchFloatValue(f64, iter, value),
.@"enum" => matchEnumValue(T, iter, value),
else => @compileError("cannot match value type '" ++ @typeName(T) ++ "' to cbor stream"), else => @compileError("cannot match value type '" ++ @typeName(T) ++ "' to cbor stream"),
}; };
} }
@ -800,7 +784,7 @@ fn hasExtractorTag(info: anytype) bool {
fn isExtractor(comptime T: type) bool { fn isExtractor(comptime T: type) bool {
return comptime switch (@typeInfo(T)) { return comptime switch (@typeInfo(T)) {
.@"struct" => |info| hasExtractorTag(info), .Struct => |info| hasExtractorTag(info),
else => false, else => false,
}; };
} }
@ -853,15 +837,15 @@ fn Extractor(comptime T: type) type {
pub fn extract(self: Self, iter: *[]const u8) Error!bool { pub fn extract(self: Self, iter: *[]const u8) Error!bool {
switch (comptime @typeInfo(T)) { switch (comptime @typeInfo(T)) {
.int, .comptime_int => return matchInt(T, iter, self.dest), .Int, .ComptimeInt => return matchInt(T, iter, self.dest),
.bool => return matchBool(iter, self.dest), .Bool => return matchBool(iter, self.dest),
.pointer => |ptr_info| switch (ptr_info.size) { .Pointer => |ptr_info| switch (ptr_info.size) {
.slice => { .Slice => {
if (ptr_info.child == u8) return matchString(iter, self.dest) else extractError(T); if (ptr_info.child == u8) return matchString(iter, self.dest) else extractError(T);
}, },
else => extractError(T), else => extractError(T),
}, },
.optional => |opt_info| { .Optional => |opt_info| {
var nested: opt_info.child = undefined; var nested: opt_info.child = undefined;
const extractor = Extractor(opt_info.child).init(&nested); const extractor = Extractor(opt_info.child).init(&nested);
if (try extractor.extract(iter)) { if (try extractor.extract(iter)) {
@ -870,8 +854,7 @@ fn Extractor(comptime T: type) type {
} }
return false; return false;
}, },
.float => return matchFloat(T, iter, self.dest), .Float => return matchFloat(T, iter, self.dest),
.@"enum" => return matchEnum(T, iter, self.dest),
else => extractError(T), else => extractError(T),
} }
} }
@ -880,8 +863,8 @@ fn Extractor(comptime T: type) type {
fn ExtractorType(comptime T: type) type { fn ExtractorType(comptime T: type) type {
const T_type_info = @typeInfo(T); const T_type_info = @typeInfo(T);
if (T_type_info != .pointer) @compileError("extract requires a pointer argument"); if (T_type_info != .Pointer) @compileError("extract requires a pointer argument");
return Extractor(T_type_info.pointer.child); return Extractor(T_type_info.Pointer.child);
} }
pub fn extract(dest: anytype) ExtractorType(@TypeOf(dest)) { pub fn extract(dest: anytype) ExtractorType(@TypeOf(dest)) {

View file

@ -58,16 +58,12 @@ using asio::windows::stream_handle;
namespace thespian::executor { namespace thespian::executor {
const char *MIN_THREAD_STR = getenv("MIN_THREAD"); // NOLINT
const auto MIN_THREAD =
static_cast<long>(atoi(MIN_THREAD_STR ? MIN_THREAD_STR : "4")); // NOLINT
const char *MAX_THREAD_STR = getenv("MAX_THREAD"); // NOLINT const char *MAX_THREAD_STR = getenv("MAX_THREAD"); // NOLINT
const auto MAX_THREAD = const auto MAX_THREAD =
static_cast<long>(atoi(MAX_THREAD_STR ? MAX_THREAD_STR : "64")); // NOLINT static_cast<long>(atoi(MAX_THREAD_STR ? MAX_THREAD_STR : "64")); // NOLINT
#if !defined(_WIN32) #if !defined(_WIN32)
const auto threads = max(min(sysconf(_SC_NPROCESSORS_ONLN), MAX_THREAD), MIN_THREAD); const auto threads = min(sysconf(_SC_NPROCESSORS_ONLN), MAX_THREAD);
#else #else
namespace { namespace {
static auto get_num_processors() -> long { static auto get_num_processors() -> long {
@ -76,7 +72,7 @@ static auto get_num_processors() -> long {
return si.dwNumberOfProcessors; return si.dwNumberOfProcessors;
} }
} // namespace } // namespace
const auto threads = max(min(get_num_processors(), MAX_THREAD), MIN_THREAD); const auto threads = min(get_num_processors(), MAX_THREAD);
#endif #endif
struct context_impl { struct context_impl {

View file

@ -145,9 +145,9 @@ const Proc = struct {
fn receive(self: *Proc, _: tp.pid_ref, m: tp.message) tp.result { fn receive(self: *Proc, _: tp.pid_ref, m: tp.message) tp.result {
errdefer self.deinit(); errdefer self.deinit();
var bytes: []const u8 = ""; var bytes: []u8 = "";
var err: i64 = 0; var err: i64 = 0;
var err_msg: []const u8 = ""; var err_msg: []u8 = "";
if (try m.match(.{ "fd", "stdout", "read_ready" })) { if (try m.match(.{ "fd", "stdout", "read_ready" })) {
try self.dispatch_stdout(); try self.dispatch_stdout();
if (self.fd_stdout) |fd_stdout| fd_stdout.wait_read() catch |e| return self.handle_error(e); if (self.fd_stdout) |fd_stdout| fd_stdout.wait_read() catch |e| return self.handle_error(e);

View file

@ -138,10 +138,10 @@ const Proc = struct {
fn receive(self: *Proc, _: tp.pid_ref, m: tp.message) tp.result { fn receive(self: *Proc, _: tp.pid_ref, m: tp.message) tp.result {
errdefer self.deinit(); errdefer self.deinit();
var bytes: []const u8 = ""; var bytes: []u8 = "";
var stream_name: []const u8 = ""; var stream_name: []u8 = "";
var err: i64 = 0; var err: i64 = 0;
var err_msg: []const u8 = ""; var err_msg: []u8 = "";
if (try m.match(.{ "stream", "stdout", "read_complete", tp.extract(&bytes) })) { if (try m.match(.{ "stream", "stdout", "read_complete", tp.extract(&bytes) })) {
try self.dispatch_stdout(bytes); try self.dispatch_stdout(bytes);
if (self.stream_stdout) |stream| stream.start_read() catch |e| return self.handle_error(e); if (self.stream_stdout) |stream| stream.start_read() catch |e| return self.handle_error(e);
@ -692,7 +692,7 @@ const Child = struct {
} }
var io_status: windows.IO_STATUS_BLOCK = undefined; var io_status: windows.IO_STATUS_BLOCK = undefined;
const num_supported_pathext = @typeInfo(CreateProcessSupportedExtension).@"enum".fields.len; const num_supported_pathext = @typeInfo(CreateProcessSupportedExtension).Enum.fields.len;
var pathext_seen = [_]bool{false} ** num_supported_pathext; var pathext_seen = [_]bool{false} ** num_supported_pathext;
var any_pathext_seen = false; var any_pathext_seen = false;
var unappended_exists = false; var unappended_exists = false;

View file

@ -138,7 +138,7 @@ pub const message = struct {
pub fn fmt(value: anytype) Self { pub fn fmt(value: anytype) Self {
message_buffer.clearRetainingCapacity(); message_buffer.clearRetainingCapacity();
const f = comptime switch (@typeInfo(@TypeOf(value))) { const f = comptime switch (@typeInfo(@TypeOf(value))) {
.@"struct" => |info| if (info.is_tuple) .Struct => |info| if (info.is_tuple)
fmt_internal fmt_internal
else else
@compileError("thespian.message template should be a tuple: " ++ @typeName(@TypeOf(value))), @compileError("thespian.message template should be a tuple: " ++ @typeName(@TypeOf(value))),
@ -158,7 +158,7 @@ pub const message = struct {
pub fn fmtbuf(buf: []u8, value: anytype) !Self { pub fn fmtbuf(buf: []u8, value: anytype) !Self {
const f = comptime switch (@typeInfo(@TypeOf(value))) { const f = comptime switch (@typeInfo(@TypeOf(value))) {
.@"struct" => |info| if (info.is_tuple) .Struct => |info| if (info.is_tuple)
fmtbuf_internal fmtbuf_internal
else else
@compileError("thespian.message template should be a tuple: " ++ @typeName(@TypeOf(value))), @compileError("thespian.message template should be a tuple: " ++ @typeName(@TypeOf(value))),
@ -221,14 +221,14 @@ pub fn exit_message(e: anytype, stack_trace: ?*std.builtin.StackTrace) message {
defer debug_info_arena_allocator.deinit(); defer debug_info_arena_allocator.deinit();
const a = debug_info_arena_allocator.allocator(); const a = debug_info_arena_allocator.allocator();
var out = std.ArrayList(u8).init(a); var out = std.ArrayList(u8).init(a);
store_stack_trace(stack_trace_.*, out.writer()); store_stack_trace(a, stack_trace_.*, out.writer());
return message.fmtbuf(&error_message_buffer, .{ "exit", e, out.items }) catch unreachable; return message.fmtbuf(&error_message_buffer, .{ "exit", e, out.items }) catch unreachable;
} else { } else {
return message.fmtbuf(&error_message_buffer, .{ "exit", e }) catch unreachable; return message.fmtbuf(&error_message_buffer, .{ "exit", e }) catch unreachable;
} }
} }
fn store_stack_trace(stack_trace: std.builtin.StackTrace, writer: anytype) void { fn store_stack_trace(a: std.mem.Allocator, stack_trace: std.builtin.StackTrace, writer: anytype) void {
nosuspend { nosuspend {
if (builtin.strip_debug_info) { if (builtin.strip_debug_info) {
writer.print("Unable to store stack trace: debug info stripped\n", .{}) catch return; writer.print("Unable to store stack trace: debug info stripped\n", .{}) catch return;
@ -238,7 +238,7 @@ fn store_stack_trace(stack_trace: std.builtin.StackTrace, writer: anytype) void
writer.print("Unable to dump stack trace: Unable to open debug info: {s}\n", .{@errorName(err)}) catch return; writer.print("Unable to dump stack trace: Unable to open debug info: {s}\n", .{@errorName(err)}) catch return;
return; return;
}; };
std.debug.writeStackTrace(stack_trace, writer, debug_info, .no_color) catch |err| { std.debug.writeStackTrace(stack_trace, writer, a, debug_info, .no_color) catch |err| {
writer.print("Unable to dump stack trace: {s}\n", .{@errorName(err)}) catch return; writer.print("Unable to dump stack trace: {s}\n", .{@errorName(err)}) catch return;
return; return;
}; };
@ -260,7 +260,7 @@ pub fn exit_fmt(comptime fmt: anytype, args: anytype) error{Exit} {
} }
pub fn exit_error(e: anyerror, stack_trace: ?*std.builtin.StackTrace) error{Exit} { pub fn exit_error(e: anyerror, stack_trace: ?*std.builtin.StackTrace) error{Exit} {
if (stack_trace_on_errors and e == error.OutOfMemory) std.debug.panic("{any}", .{e}); if (stack_trace_on_errors and e == error.OutOfMemory) std.debug.panicExtra(stack_trace, null, "{any}", .{e});
return switch (e) { return switch (e) {
error.Exit => error.Exit, error.Exit => error.Exit,
else => set_error_msg(exit_message(e, stack_trace)), else => set_error_msg(exit_message(e, stack_trace)),
@ -336,7 +336,6 @@ pub const channel = struct {
pub const event: c.thespian_trace_channel = 2048; pub const event: c.thespian_trace_channel = 2048;
pub const widget: c.thespian_trace_channel = 4096; pub const widget: c.thespian_trace_channel = 4096;
pub const input: c.thespian_trace_channel = 8192; pub const input: c.thespian_trace_channel = 8192;
pub const debug: c.thespian_trace_channel = 16384;
pub const all = c.thespian_trace_channel_all; pub const all = c.thespian_trace_channel_all;
}; };
@ -428,8 +427,7 @@ pub fn trace(chan: trace_channel, value: anytype) void {
env.get().trace(value.to(message.c_buffer_type)); env.get().trace(value.to(message.c_buffer_type));
} else { } else {
var trace_buffer: [512]u8 = undefined; var trace_buffer: [512]u8 = undefined;
const m = message.fmtbuf(&trace_buffer, value) catch |e| const m = message.fmtbuf(&trace_buffer, value);
std.debug.panic("TRACE ERROR: {}", .{e});
env.get().trace(m.to(message.c_buffer_type)); env.get().trace(m.to(message.c_buffer_type));
} }
} }
@ -499,14 +497,14 @@ fn log_last_error(err: anytype) @TypeOf(err) {
fn exitHandlerRun(comptime T: type) c.thespian_exit_handler { fn exitHandlerRun(comptime T: type) c.thespian_exit_handler {
if (T == @TypeOf(null)) return null; if (T == @TypeOf(null)) return null;
return switch (@typeInfo(T)) { return switch (@typeInfo(T)) {
.optional => |info| switch (@typeInfo(info.child)) { .Optional => |info| switch (@typeInfo(info.child)) {
.pointer => |ptr_info| switch (ptr_info.size) { .Pointer => |ptr_info| switch (ptr_info.size) {
.one => ptr_info.child.run, .One => ptr_info.child.run,
else => @compileError("expected single item pointer, found: '" ++ @typeName(T) ++ "'"), else => @compileError("expected single item pointer, found: '" ++ @typeName(T) ++ "'"),
}, },
}, },
.pointer => |ptr_info| switch (ptr_info.size) { .Pointer => |ptr_info| switch (ptr_info.size) {
.one => ptr_info.child.run, .One => ptr_info.child.run,
else => @compileError("expected single item pointer, found: '" ++ @typeName(T) ++ "'"), else => @compileError("expected single item pointer, found: '" ++ @typeName(T) ++ "'"),
}, },
else => @compileError("expected optional pointer or pointer type, found: '" ++ @typeName(T) ++ "'"), else => @compileError("expected optional pointer or pointer type, found: '" ++ @typeName(T) ++ "'"),
@ -515,8 +513,8 @@ fn exitHandlerRun(comptime T: type) c.thespian_exit_handler {
pub fn receive(r: anytype) void { pub fn receive(r: anytype) void {
const T = switch (@typeInfo(@TypeOf(r))) { const T = switch (@typeInfo(@TypeOf(r))) {
.pointer => |ptr_info| switch (ptr_info.size) { .Pointer => |ptr_info| switch (ptr_info.size) {
.one => ptr_info.child, .One => ptr_info.child,
else => @compileError("invalid receiver type"), else => @compileError("invalid receiver type"),
}, },
else => @compileError("invalid receiver type"), else => @compileError("invalid receiver type"),

View file

@ -151,7 +151,7 @@ test "cbor.matchValue(i64) multi" {
var buf: [128]u8 = undefined; var buf: [128]u8 = undefined;
const iter = fmt(&buf, 7); const iter = fmt(&buf, 7);
const iter2 = fmt(buf[iter.len..], 8); const iter2 = fmt(buf[iter.len..], 8);
var iter3: []const u8 = buf[0 .. iter.len + iter2.len]; var iter3 = buf[0 .. iter.len + iter2.len];
try expect(try matchValue(&iter3, 7)); try expect(try matchValue(&iter3, 7));
try expect(try matchValue(&iter3, 8)); try expect(try matchValue(&iter3, 8));
} }