Function fromZoir [src]
Like fromSlice, but operates on Zoir instead of ZON source.
Prototype
pub fn fromZoir( T: type, ast: Ast, zoir: Zoir, diag: ?*Diagnostics, options: Options, ) error{ParseZon}!T
Parameters
T: type
ast: Ast
zoir: Zoir
diag: ?*Diagnostics
options: Options
Possible Errors
Source
pub fn fromZoir(
T: type,
ast: Ast,
zoir: Zoir,
diag: ?*Diagnostics,
options: Options,
) error{ParseZon}!T {
comptime assert(!requiresAllocator(T));
var buf: [0]u8 = .{};
var failing_allocator = std.heap.FixedBufferAllocator.init(&buf);
return fromZoirAlloc(
T,
failing_allocator.allocator(),
ast,
zoir,
diag,
options,
) catch |err| switch (err) {
error.OutOfMemory => unreachable, // Checked by comptime assertion above
else => |e| return e,
};
}