diff options
| -rw-r--r-- | src/lib.zig | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/lib.zig b/src/lib.zig index 8e99ad3..c84829f 100644 --- a/src/lib.zig +++ b/src/lib.zig @@ -40,6 +40,10 @@ pub fn mapAlloc( if(itemsTypeInfo != .array and itemsTypeInfo != .pointer) { @compileError("Expected array or slice, found " ++ @typeName(itemsType)); } + switch (itemsTypeInfo) { + .pointer => |p| if(p.size != .many and p.size != .slice) @compileError("Expected pointer of size 'many' or 'slice', found " ++ @tagName(p)), + else =>{}, + } break :blk []funcTypeInfo.@"fn".return_type.?; } { @@ -68,6 +72,10 @@ pub fn map( @compileError("Expected array, found " ++ @typeName(itemsType)); if(bufferTypeInfo != .array and bufferTypeInfo != .pointer) @compileError("Expected array, found " ++ @typeName(bufferType)); + switch (itemsTypeInfo) { + .pointer => |p| if(p.size != .many and p.size != .slice) @compileError("Expected pointer of size 'many' or 'slice', found '" ++ @tagName(p.size) ++ "'"), + else =>{}, + } for (items, 0..) |item, i| buffer.*[i] = func(item); } |
