tangled
alpha
login
or
join now
altagos.dev
/
pretty
0
fork
atom
A pretty printer for zig
zig
0
fork
atom
overview
issues
pulls
pipelines
runtime is always const
altagos.dev
1 month ago
71aa5e05
1afbb8c6
verified
This commit was signed with the committer's
known signature
.
altagos.dev
SSH Key Fingerprint:
SHA256:UbTjEcCZlc6GzQWLCuDK3D//HESWD2xFPkzue9XMras=
+12
-12
1 changed file
expand all
collapse all
unified
split
pretty.zig
+12
-12
pretty.zig
···
204
204
fn innerFmt(
205
205
comptime T: type,
206
206
comptime ctx: Context,
207
207
-
run: *Runtime,
207
207
+
run: *const Runtime,
208
208
value: T,
209
209
comptime opts: InnerFmtOptions,
210
210
) error{WriteFailed}!void {
···
263
263
inline fn printType(
264
264
comptime T: type,
265
265
comptime ctx: Context,
266
266
-
run: *Runtime,
266
266
+
run: *const Runtime,
267
267
value: T,
268
268
) error{WriteFailed}!void {
269
269
const active_type = comptime std.meta.activeTag(@typeInfo(T));
···
342
342
inline fn formatOptional(
343
343
comptime T: type,
344
344
comptime ctx: Context,
345
345
-
run: *Runtime,
345
345
+
run: *const Runtime,
346
346
value: ?T,
347
347
) !void {
348
348
return if (value) |val|
···
355
355
comptime T: type,
356
356
comptime ctx: Context,
357
357
comptime st: Type.Struct,
358
358
-
run: *Runtime,
358
358
+
run: *const Runtime,
359
359
value: T,
360
360
) !void {
361
361
const next_ctx = Context{
···
399
399
inline fn formatUnion(
400
400
comptime T: type,
401
401
comptime ctx: Context,
402
402
-
run: *Runtime,
402
402
+
run: *const Runtime,
403
403
value: T,
404
404
) !void {
405
405
switch (value) {
···
410
410
inline fn formatArray(
411
411
comptime ctx: Context,
412
412
comptime arr: Type.Array,
413
413
-
run: *Runtime,
413
413
+
run: *const Runtime,
414
414
value: anytype,
415
415
) !void {
416
416
const next_ctx = Context{
···
453
453
inline fn formatVector(
454
454
comptime ctx: Context,
455
455
comptime vec: Type.Vector,
456
456
-
run: *Runtime,
456
456
+
run: *const Runtime,
457
457
value: @Vector(vec.len, vec.child),
458
458
) !void {
459
459
run.setColor(ctx, .dim);
···
478
478
inline fn formatPtrOne(
479
479
comptime ctx: Context,
480
480
comptime ptr: Type.Pointer,
481
481
-
run: *Runtime,
481
481
+
run: *const Runtime,
482
482
value: anytype,
483
483
) !void {
484
484
const is_string = switch (@typeInfo(ptr.child)) {
···
493
493
inline fn formatPtrSlice(
494
494
comptime ctx: Context,
495
495
comptime ptr: Type.Pointer,
496
496
-
run: *Runtime,
496
496
+
run: *const Runtime,
497
497
value: anytype,
498
498
) !void {
499
499
if (ptr.child == u8 and ctx.options.ptr_slice_u8_as_string)
···
536
536
inline fn formatPtrMany(
537
537
comptime ctx: Context,
538
538
comptime ptr: Type.Pointer,
539
539
-
run: *Runtime,
539
539
+
run: *const Runtime,
540
540
value: anytype,
541
541
) !void {
542
542
_ = ptr;
···
548
548
549
549
inline fn formatString(
550
550
comptime ctx: Context,
551
551
-
run: *Runtime,
551
551
+
run: *const Runtime,
552
552
value: anytype,
553
553
) !void {
554
554
run.setColor(ctx, .string);
···
571
571
572
572
inline fn formatErrorUnion(
573
573
comptime ctx: Context,
574
574
-
run: *Runtime,
574
574
+
run: *const Runtime,
575
575
value: anytype,
576
576
) !void {
577
577
const val = value catch |err| return formatErrorSet(ctx, run, err);