blob: 0c3e668f379e83f47aa2445179b9f805d0d5d808 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
const std = @import("std");
pub const Result = union(enum) {
int: i32,
string: []const u8,
pub fn cmp(self: Result, result: Result) bool {
switch (self) {
.int => |i| return i == result.int,
.string => |s| return std.mem.eql(u8, s, result.string),
}
}
pub fn deinit(self: Result, allocator: std.mem.Allocator) void {
switch (self) {
.string => |s| return allocator.free(s),
else => {},
}
}
};
|