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 {
3333 node_or_offset: u32,
3434 notes: []Note,
3535
36 const InitOptions = struct {
36 const Options = struct {
3737 msg: []const u8,
3838 token: Ast.OptionalTokenIndex,
3939 node_or_offset: u32,
4040 notes: []Note,
4141 };
4242
43 fn init(ast: *const Ast, options: InitOptions) Error {
43 fn init(ast: *const Ast, options: Error.Options) Error {
4444 return .{
4545 .msg = options.msg,
4646 .loc = astLoc(ast, options.token, options.node_or_offset),
......@@ -74,13 +74,13 @@ pub const Error = struct {
7474 /// Otherwise, this is a byte offset into `token`.
7575 node_or_offset: u32,
7676
77 const InitOptions = struct {
77 const Options = struct {
7878 msg: []const u8,
7979 token: Ast.OptionalTokenIndex,
8080 node_or_offset: u32,
8181 };
8282
83 fn init(ast: *const Ast, options: @This().InitOptions) @This() {
83 fn init(ast: *const Ast, options: Note.Options) @This() {
8484 return .{
8585 .msg = options.msg,
8686 .loc = astLoc(ast, options.token, options.node_or_offset),
......@@ -200,7 +200,7 @@ pub const Errors = struct {
200200 };
201201};
202202
203pub const FromSliceOptions = struct {
203pub const Options = struct {
204204 /// Used for scratch allocations.
205205 gpa: Allocator,
206206 /// Used for allocating errors and results.
......@@ -218,7 +218,7 @@ pub const FromSliceOptions = struct {
218218///
219219/// Human readable errors are written to `options.errors`. `options.arena` owns the errors, and any
220220/// 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 {
222222 var value: T = undefined;
223223 try fromSliceInner(T, &value, false, options);
224224 return value;
......@@ -264,7 +264,7 @@ test fromSlice {
264264
265265/// Like `fromSlice` but the result type may not contain pointers, allowing it to outlive
266266/// `options.arena`.
267pub fn fromSliceNoAlloc(T: type, options: FromSliceOptions) error{ OutOfMemory, ParseZon }!T {
267pub fn fromSliceNoAlloc(T: type, options: Options) error{ OutOfMemory, ParseZon }!T {
268268 comptime assert(!requiresAllocator(T));
269269 return fromSlice(T, options);
270270}
......@@ -277,7 +277,7 @@ pub fn fromSliceNoAlloc(T: type, options: FromSliceOptions) error{ OutOfMemory,
277277pub fn updateFromSlice(
278278 T: type,
279279 value: *T,
280 options: FromSliceOptions,
280 options: Options,
281281) error{ OutOfMemory, ParseZon }!void {
282282 try fromSliceInner(T, value, true, options);
283283}
......@@ -348,7 +348,7 @@ test updateFromSlice {
348348pub fn updateFromSliceNoAlloc(
349349 T: type,
350350 value: *T,
351 options: FromSliceOptions,
351 options: Options,
352352) error{ OutOfMemory, ParseZon }!void {
353353 comptime assert(!requiresAllocator(T));
354354 try fromSliceInner(T, value, true, options);
......@@ -358,7 +358,7 @@ fn fromSliceInner(
358358 T: type,
359359 value: *T,
360360 initialized: bool,
361 options: FromSliceOptions,
361 options: Options,
362362) error{ OutOfMemory, ParseZon }!void {
363363 var errors: std.ArrayList(Error) = .empty;
364364 defer options.errors.items = errors.items;