typeContainsSlice
Function parameters
Parameters
- K:type
Describes how pointer types should be hashed.
Types
- HashStrategy
- Describes how pointer types should be hashed.
Helper function to hash a pointer and mutate the strategy if needed.
Functions
- hashPointer
- Helper function to hash a pointer and mutate the strategy if needed.
- hashArray
- Helper function to hash a set of contiguous objects, from an array or slice.
- hash
- Provides generic hashing for any eligible type.
- autoHash
- Provides generic hashing for any eligible type.
Source
Implementation
inline fn typeContainsSlice(comptime K: type) bool {
return switch (@typeInfo(K)) {
.pointer => |info| info.size == .slice,
inline .@"struct", .@"union" => |info| {
inline for (info.fields) |field| {
if (typeContainsSlice(field.type)) {
return true;
}
}
return false;
},
else => false,
};
}