Files
FileTime3/src/core/provider/provider.zig
2025-04-23 14:12:37 +02:00

33 lines
822 B
Zig

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;