zig-lys/src/args/parsers/numNullable.zig

12 lines
293 B
Zig
Raw Normal View History

2024-11-29 17:36:56 +00:00
const std = @import("std");
pub fn numNullable(comptime T: type) *const fn (value: []const u8) anyerror!?T {
const container = struct {
fn func(value: []const u8) anyerror!?T {
return try std.fmt.parseInt(T, value, 10);
}
};
return &container.func;
}