| ... | ... | @@ -535,7 +535,7 @@ pub const ValueIndex = enum(u32) { |
| 535 | 535 | return this.v().string.to(); |
| 536 | 536 | } |
| 537 | 537 | |
| 538 | | pub fn array(this: ValueIndex) []align(1) const ValueIndex { |
| 538 | pub fn array(this: ValueIndex) Array { |
| 539 | 539 | return this.v().array.to(); |
| 540 | 540 | } |
| 541 | 541 | |
| ... | ... | @@ -581,6 +581,8 @@ pub const Value = union(enum(u8)) { |
| 581 | 581 | } |
| 582 | 582 | }; |
| 583 | 583 | |
| 584 | pub const Array = []align(1) const ValueIndex; |
| 585 | |
| 584 | 586 | pub const StringIndex = enum(u32) { |
| 585 | 587 | _, |
| 586 | 588 | |
| ... | ... | @@ -616,7 +618,7 @@ pub const ArrayIndex = enum(u32) { |
| 616 | 618 | try writer.writeAll("]"); |
| 617 | 619 | } |
| 618 | 620 | |
| 619 | | pub fn to(this: ArrayIndex) []align(1) const ValueIndex { |
| 621 | pub fn to(this: ArrayIndex) Array { |
| 620 | 622 | var d = doc.?.extras.ptr[@intFromEnum(this)..]; |
| 621 | 623 | std.debug.assert(@as(Value.Tag, @enumFromInt(d[0])) == .array); |
| 622 | 624 | const len: u32 = @bitCast(d[1..5].*); |
| ... | ... | @@ -642,7 +644,7 @@ pub const ObjectIndex = enum(u32) { |
| 642 | 644 | try writer.writeAll("}"); |
| 643 | 645 | } |
| 644 | 646 | |
| 645 | | pub fn to(this: ObjectIndex) struct { []align(1) const StringIndex, []align(1) const ValueIndex } { |
| 647 | pub fn to(this: ObjectIndex) struct { []align(1) const StringIndex, Array } { |
| 646 | 648 | var d = doc.?.extras.ptr[@intFromEnum(this)..]; |
| 647 | 649 | std.debug.assert(@as(Value.Tag, @enumFromInt(d[0])) == .object); |
| 648 | 650 | const len: u32 = @bitCast(d[1..5].*); |
| ... | ... | @@ -670,7 +672,7 @@ pub const ObjectIndex = enum(u32) { |
| 670 | 672 | return if (this.get(needle, .object)) |v| v.object() else null; |
| 671 | 673 | } |
| 672 | 674 | |
| 673 | | pub fn getA(this: ObjectIndex, needle: []const u8) ?[]align(1) const ValueIndex { |
| 675 | pub fn getA(this: ObjectIndex, needle: []const u8) ?Array { |
| 674 | 676 | return if (this.get(needle, .array)) |v| v.array() else null; |
| 675 | 677 | } |
| 676 | 678 | |