feat: base project

This commit is contained in:
2025-04-23 14:12:37 +02:00
parent ac72a405d8
commit 490425bfd9
8 changed files with 539 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
pub const VTable = struct {
getItemByFullName: *const fn (
self: *anyopaque,
fullName: FullName,
allocator: std.mem.Allocator,
globalAllocator: std.mem.Allocator,
) GetItemsError!Item,
};
pub const GetItemsError = error{
OutOfMemory,
NotExists,
};
pub const Provider = struct {
object: *anyopaque,
vtable: *const VTable,
pub inline fn getItemByFullName(
self: *const Provider,
fullName: FullName,
allocator: std.mem.Allocator,
globalAllocator: std.mem.Allocator,
) GetItemsError!Item {
return &self.vtable.getItemByFullName(self.object, fullName, allocator, globalAllocator);
}
};
const std = @import("std");
const models = @import("../models.zig");
const Item = models.Item;
const FullName = models.FullName;