authorgravatar for mason@gamesbymason.comMason Remaley <mason@gamesbymason.com> 2026-08-12 15:09:25-07:00
committergravatar for mason@gamesbymason.comMason Remaley <mason@gamesbymason.com> 2026-09-26 12:35:38-07:00
log472a0305b82890592095f98904eca4a1a6a4ef06
treea0942902dd623de3c6a632d959f528a25753153d
parent3b779c2e276d4b22a8d398b36379c173a607fa21

Rename all option structs to `Options`


1 files changed, 10 insertions(+), 10 deletions(-)

lib/std/zon/parse.zig+10-10
...@@ -33,14 +33,14 @@ pub const Error = struct {...@@ -33,14 +33,14 @@ pub const Error = struct {
33 node_or_offset: u32,33 node_or_offset: u32,
34 notes: []Note,34 notes: []Note,
3535
36 const InitOptions = struct {36 const Options = struct {
37 msg: []const u8,37 msg: []const u8,
38 token: Ast.OptionalTokenIndex,38 token: Ast.OptionalTokenIndex,
39 node_or_offset: u32,39 node_or_offset: u32,
40 notes: []Note,40 notes: []Note,
41 };41 };
4242
43 fn init(ast: *const Ast, options: InitOptions) Error {43 fn init(ast: *const Ast, options: Error.Options) Error {
44 return .{44 return .{
45 .msg = options.msg,45 .msg = options.msg,
46 .loc = astLoc(ast, options.token, options.node_or_offset),46 .loc = astLoc(ast, options.token, options.node_or_offset),
...@@ -74,13 +74,13 @@ pub const Error = struct {...@@ -74,13 +74,13 @@ pub const Error = struct {
74 /// Otherwise, this is a byte offset into `token`.74 /// Otherwise, this is a byte offset into `token`.
75 node_or_offset: u32,75 node_or_offset: u32,
7676
77 const InitOptions = struct {77 const Options = struct {
78 msg: []const u8,78 msg: []const u8,
79 token: Ast.OptionalTokenIndex,79 token: Ast.OptionalTokenIndex,
80 node_or_offset: u32,80 node_or_offset: u32,
81 };81 };
8282
83 fn init(ast: *const Ast, options: @This().InitOptions) @This() {83 fn init(ast: *const Ast, options: Note.Options) @This() {
84 return .{84 return .{
85 .msg = options.msg,85 .msg = options.msg,
86 .loc = astLoc(ast, options.token, options.node_or_offset),86 .loc = astLoc(ast, options.token, options.node_or_offset),
...@@ -200,7 +200,7 @@ pub const Errors = struct {...@@ -200,7 +200,7 @@ pub const Errors = struct {
200 };200 };
201};201};
202202
203pub const FromSliceOptions = struct {203pub const Options = struct {
204 /// Used for scratch allocations.204 /// Used for scratch allocations.
205 gpa: Allocator,205 gpa: Allocator,
206 /// Used for allocating errors and results.206 /// Used for allocating errors and results.
...@@ -218,7 +218,7 @@ pub const FromSliceOptions = struct {...@@ -218,7 +218,7 @@ pub const FromSliceOptions = struct {
218///218///
219/// Human readable errors are written to `options.errors`. `options.arena` owns the errors, and any219/// Human readable errors are written to `options.errors`. `options.arena` owns the errors, and any
220/// pointers that are part of `T`.220/// pointers that are part of `T`.
221pub fn fromSlice(T: type, options: FromSliceOptions) error{ OutOfMemory, ParseZon }!T {221pub fn fromSlice(T: type, options: Options) error{ OutOfMemory, ParseZon }!T {
222 var value: T = undefined;222 var value: T = undefined;
223 try fromSliceInner(T, &value, false, options);223 try fromSliceInner(T, &value, false, options);
224 return value;224 return value;
...@@ -264,7 +264,7 @@ test fromSlice {...@@ -264,7 +264,7 @@ test fromSlice {
264264
265/// Like `fromSlice` but the result type may not contain pointers, allowing it to outlive265/// Like `fromSlice` but the result type may not contain pointers, allowing it to outlive
266/// `options.arena`.266/// `options.arena`.
267pub fn fromSliceNoAlloc(T: type, options: FromSliceOptions) error{ OutOfMemory, ParseZon }!T {267pub fn fromSliceNoAlloc(T: type, options: Options) error{ OutOfMemory, ParseZon }!T {
268 comptime assert(!requiresAllocator(T));268 comptime assert(!requiresAllocator(T));
269 return fromSlice(T, options);269 return fromSlice(T, options);
270}270}
...@@ -277,7 +277,7 @@ pub fn fromSliceNoAlloc(T: type, options: FromSliceOptions) error{ OutOfMemory,...@@ -277,7 +277,7 @@ pub fn fromSliceNoAlloc(T: type, options: FromSliceOptions) error{ OutOfMemory,
277pub fn updateFromSlice(277pub fn updateFromSlice(
278 T: type,278 T: type,
279 value: *T,279 value: *T,
280 options: FromSliceOptions,280 options: Options,
281) error{ OutOfMemory, ParseZon }!void {281) error{ OutOfMemory, ParseZon }!void {
282 try fromSliceInner(T, value, true, options);282 try fromSliceInner(T, value, true, options);
283}283}
...@@ -348,7 +348,7 @@ test updateFromSlice {...@@ -348,7 +348,7 @@ test updateFromSlice {
348pub fn updateFromSliceNoAlloc(348pub fn updateFromSliceNoAlloc(
349 T: type,349 T: type,
350 value: *T,350 value: *T,
351 options: FromSliceOptions,351 options: Options,
352) error{ OutOfMemory, ParseZon }!void {352) error{ OutOfMemory, ParseZon }!void {
353 comptime assert(!requiresAllocator(T));353 comptime assert(!requiresAllocator(T));
354 try fromSliceInner(T, value, true, options);354 try fromSliceInner(T, value, true, options);
...@@ -358,7 +358,7 @@ fn fromSliceInner(...@@ -358,7 +358,7 @@ fn fromSliceInner(
358 T: type,358 T: type,
359 value: *T,359 value: *T,
360 initialized: bool,360 initialized: bool,
361 options: FromSliceOptions,361 options: Options,
362) error{ OutOfMemory, ParseZon }!void {362) error{ OutOfMemory, ParseZon }!void {
363 var errors: std.ArrayList(Error) = .empty;363 var errors: std.ArrayList(Error) = .empty;
364 defer options.errors.items = errors.items;364 defer options.errors.items = errors.items;