camelCase for function names

This commit is contained in:
duck
2025-05-04 17:49:28 +05:00
parent b133a747ae
commit c19120c3fc
8 changed files with 102 additions and 103 deletions

View File

@@ -13,20 +13,20 @@ pub const Request = union(enum) {
};
const Self = @This();
pub fn from_function(comptime function: anytype, alloc: std.mem.Allocator) !Self {
utils.validate_system(function);
pub fn fromFunction(comptime function: anytype, alloc: std.mem.Allocator) !Self {
utils.validateSystem(function);
var requests: [@typeInfo(@TypeOf(function)).Fn.params.len]Request = undefined;
inline for (0.., @typeInfo(@TypeOf(function)).Fn.params) |i, param| {
switch (@typeInfo(param.type.?).Pointer.child) {
var requests: [@typeInfo(@TypeOf(function)).@"fn".params.len]Request = undefined;
inline for (0.., @typeInfo(@TypeOf(function)).@"fn".params) |i, param| {
switch (@typeInfo(param.type.?).pointer.child) {
Controller => requests[i] = .controller,
else => |resource_type| requests[i] = .{ .resource = utils.hash_type(resource_type) },
else => |resource_type| requests[i] = .{ .resource = utils.hashType(resource_type) },
}
}
return Self{
.requested_types = try alloc.dupe(Request, &requests),
.function_runner = utils.generate_runner(function),
.function_runner = utils.generateRunner(function),
};
}