| ... | ... | @@ -426,10 +426,8 @@ pub const Document = struct { |
| 426 | 426 | doc = null; |
| 427 | 427 | } |
| 428 | 428 | |
| 429 | | pub fn format(this: *const Document, comptime fmt: []const u8, options: std.fmt.FormatOptions, writer: anytype) !void { |
| 430 | | _ = fmt; |
| 431 | | _ = options; |
| 432 | | return std.fmt.format(writer, "{}", .{this.root}); |
| 429 | pub fn nprint(this: *const Document, writer: anytype) !void { |
| 430 | return nio.fmt.format(writer, "{}", .{this.root}); |
| 433 | 431 | } |
| 434 | 432 | |
| 435 | 433 | pub fn stringify(this: *const Document, writer: anytype, space: Space, indent: u8) Instance(@TypeOf(writer)).WriteError!void { |
| ... | ... | @@ -449,10 +447,8 @@ pub const ValueIndex = enum(u32) { |
| 449 | 447 | empty_object = 14, |
| 450 | 448 | _, |
| 451 | 449 | |
| 452 | | pub fn format(this: ValueIndex, comptime fmt: []const u8, options: std.fmt.FormatOptions, writer: anytype) !void { |
| 453 | | _ = fmt; |
| 454 | | _ = options; |
| 455 | | return std.fmt.format(writer, "{}", .{this.v()}); |
| 450 | pub fn nprint(this: ValueIndex, writer: anytype) !void { |
| 451 | return nio.fmt.format(writer, "{}", .{this.v()}); |
| 456 | 452 | } |
| 457 | 453 | |
| 458 | 454 | fn stringify(this: ValueIndex, writer: anytype, space: Space, indent: u8) !void { |
| ... | ... | @@ -508,15 +504,13 @@ pub const Value = union(enum(u8)) { |
| 508 | 504 | |
| 509 | 505 | const Tag = std.meta.Tag(@This()); |
| 510 | 506 | |
| 511 | | pub fn format(this: Value, comptime fmt: []const u8, options: std.fmt.FormatOptions, writer: anytype) !void { |
| 512 | | _ = options; |
| 513 | | _ = fmt; |
| 507 | pub fn nprint(this: Value, writer: anytype) !void { |
| 514 | 508 | return switch (this) { |
| 515 | 509 | .zero => unreachable, |
| 516 | | .null => std.fmt.format(writer, "null", .{}), |
| 517 | | .true => std.fmt.format(writer, "true", .{}), |
| 518 | | .false => std.fmt.format(writer, "false", .{}), |
| 519 | | inline .object, .array, .string, .number => |t| std.fmt.format(writer, "{}", .{t}), |
| 510 | .null => nio.fmt.format(writer, "null", .{}), |
| 511 | .true => nio.fmt.format(writer, "true", .{}), |
| 512 | .false => nio.fmt.format(writer, "false", .{}), |
| 513 | inline .object, .array, .string, .number => |t| nio.fmt.format(writer, "{}", .{t}), |
| 520 | 514 | }; |
| 521 | 515 | } |
| 522 | 516 | |
| ... | ... | @@ -537,9 +531,7 @@ pub const Array = []align(1) const ValueIndex; |
| 537 | 531 | pub const StringIndex = enum(u32) { |
| 538 | 532 | _, |
| 539 | 533 | |
| 540 | | pub fn format(this: StringIndex, comptime fmt: []const u8, options: std.fmt.FormatOptions, writer: anytype) !void { |
| 541 | | _ = options; |
| 542 | | _ = fmt; |
| 534 | pub fn nprint(this: StringIndex, writer: anytype) !void { |
| 543 | 535 | try writer.writeAll("\""); |
| 544 | 536 | try writer.writeAll(this.to()); |
| 545 | 537 | try writer.writeAll("\""); |
| ... | ... | @@ -562,10 +554,7 @@ pub const StringIndex = enum(u32) { |
| 562 | 554 | pub const ArrayIndex = enum(u32) { |
| 563 | 555 | _, |
| 564 | 556 | |
| 565 | | pub fn format(this: ArrayIndex, comptime fmt: []const u8, options: std.fmt.FormatOptions, writer: anytype) !void { |
| 566 | | _ = options; |
| 567 | | _ = fmt; |
| 568 | | |
| 557 | pub fn nprint(this: ArrayIndex, writer: anytype) !void { |
| 569 | 558 | const items = this.to(); |
| 570 | 559 | try writer.writeAll("["); |
| 571 | 560 | for (items, 0..) |item, i| { |
| ... | ... | @@ -602,9 +591,7 @@ pub const ArrayIndex = enum(u32) { |
| 602 | 591 | pub const ObjectIndex = enum(u32) { |
| 603 | 592 | _, |
| 604 | 593 | |
| 605 | | pub fn format(this: ObjectIndex, comptime fmt: []const u8, options: std.fmt.FormatOptions, writer: anytype) !void { |
| 606 | | _ = options; |
| 607 | | _ = fmt; |
| 594 | pub fn nprint(this: ObjectIndex, writer: anytype) !void { |
| 608 | 595 | const keys, const values = this.to(); |
| 609 | 596 | try writer.writeAll("{"); |
| 610 | 597 | for (keys, values, 0..) |k, v, i| { |
| ... | ... | @@ -696,9 +683,7 @@ pub const ObjectIndex = enum(u32) { |
| 696 | 683 | pub const NumberIndex = enum(u32) { |
| 697 | 684 | _, |
| 698 | 685 | |
| 699 | | pub fn format(this: NumberIndex, comptime fmt: []const u8, options: std.fmt.FormatOptions, writer: anytype) !void { |
| 700 | | _ = options; |
| 701 | | _ = fmt; |
| 686 | pub fn nprint(this: NumberIndex, writer: anytype) !void { |
| 702 | 687 | try writer.writeAll(this.to()); |
| 703 | 688 | } |
| 704 | 689 | |