Skip to content

Instantly share code, notes, and snippets.

View zigster64's full-sized avatar

Scribe of the Ziggurat zigster64

  • Outback Australia, middle of nowhere
  • 18:03 (UTC +10:00)
View GitHub Profile
const std = @import("std");
const Stuff = enum { zeroth, first, second, third, somethingElse };
const OtherStuff = enum { zeroth, first, second, third, somethingElse };
const EnumLookupError = error{InvalidName};
// convert a string into a enum field
pub fn stringToEnum(comptime E: type, name: []const u8) EnumLookupError!E {
inline for (std.meta.fields(E)) |e| {
if (std.mem.eql(u8, name, e.name)) {