enum Index [src]
Index into nodes.
Fields
root = 0
_
Members
- toOffset (Function)
- toOptional (Function)
Source
pub const Index = enum(u32) {
root = 0,
_,
pub fn toOptional(i: Index) OptionalIndex {
const result: OptionalIndex = @enumFromInt(@intFromEnum(i));
assert(result != .none);
return result;
}
pub fn toOffset(base: Index, destination: Index) Offset {
const base_i64: i64 = @intFromEnum(base);
const destination_i64: i64 = @intFromEnum(destination);
return @enumFromInt(destination_i64 - base_i64);
}
}