diff options
| author | 2023-11-23 21:35:56 +0100 | |
|---|---|---|
| committer | 2023-11-23 21:36:06 +0100 | |
| commit | a84d698f9a449e08b383f97d1fb81a206186da26 (patch) | |
| tree | 191c0ac15659665390a6e958a98208dc8d08053a | |
| parent | add the fasFn helper (diff) | |
| download | zig-sqlite-a84d698f9a449e08b383f97d1fb81a206186da26.tar.gz zig-sqlite-a84d698f9a449e08b383f97d1fb81a206186da26.tar.xz zig-sqlite-a84d698f9a449e08b383f97d1fb81a206186da26.zip | |
use @hasField
| -rw-r--r-- | sqlite.zig | 6 |
1 files changed, 3 insertions, 3 deletions
| @@ -1349,7 +1349,7 @@ pub fn Iterator(comptime Type: type) type { | |||
| 1349 | if (!comptime isStruct(@TypeOf(options))) { | 1349 | if (!comptime isStruct(@TypeOf(options))) { |
| 1350 | @compileError("options passed to readPointer must be a struct"); | 1350 | @compileError("options passed to readPointer must be a struct"); |
| 1351 | } | 1351 | } |
| 1352 | if (!comptime std.meta.trait.hasField("allocator")(@TypeOf(options))) { | 1352 | if (!@hasField(@TypeOf(options), "allocator")) { |
| 1353 | @compileError("options passed to readPointer must have an allocator field"); | 1353 | @compileError("options passed to readPointer must have an allocator field"); |
| 1354 | } | 1354 | } |
| 1355 | 1355 | ||
| @@ -1448,13 +1448,13 @@ pub fn Iterator(comptime Type: type) type { | |||
| 1448 | 1448 | ||
| 1449 | return switch (FieldType) { | 1449 | return switch (FieldType) { |
| 1450 | Blob => blk: { | 1450 | Blob => blk: { |
| 1451 | if (!comptime std.meta.trait.hasField("allocator")(@TypeOf(options))) { | 1451 | if (!@hasField(@TypeOf(options), "allocator")) { |
| 1452 | @compileError("options passed to readPointer must have an allocator field when reading a Blob"); | 1452 | @compileError("options passed to readPointer must have an allocator field when reading a Blob"); |
| 1453 | } | 1453 | } |
| 1454 | break :blk try self.readBytes(Blob, options.allocator, i, .Blob); | 1454 | break :blk try self.readBytes(Blob, options.allocator, i, .Blob); |
| 1455 | }, | 1455 | }, |
| 1456 | Text => blk: { | 1456 | Text => blk: { |
| 1457 | if (!comptime std.meta.trait.hasField("allocator")(@TypeOf(options))) { | 1457 | if (!@hasField(@TypeOf(options), "allocator")) { |
| 1458 | @compileError("options passed to readField must have an allocator field when reading a Text"); | 1458 | @compileError("options passed to readField must have an allocator field when reading a Text"); |
| 1459 | } | 1459 | } |
| 1460 | break :blk try self.readBytes(Text, options.allocator, i, .Text); | 1460 | break :blk try self.readBytes(Text, options.allocator, i, .Text); |