Function defaultSpec [src]

Prototype

pub fn defaultSpec(comptime T: type) [:0]const u8

Parameters

T: type

Source

pub fn defaultSpec(comptime T: type) [:0]const u8 { switch (@typeInfo(T)) { .array, .vector => return ANY, .pointer => |ptr_info| switch (ptr_info.size) { .one => switch (@typeInfo(ptr_info.child)) { .array => return ANY, else => {}, }, .many, .c => return "*", .slice => return ANY, }, .optional => |info| return "?" ++ defaultSpec(info.child), .error_union => |info| return "!" ++ defaultSpec(info.payload), else => {}, } return ""; }