pub const AnySeeker = struct {
context: ?*anyopaque,
getEndPosFn: ?*const fn (self: ?*anyopaque) anyerror!u64,
pub inline fn getEndPos(self: AnySeeker) anyerror!?u64 {
return (self.getEndPosFn orelse return null)(self.context);
}
};
When the getEndPos
function is called, the following error appears:
stream.zig:26:53: error: expected type 'anyerror!?u64', found 'anyerror!u64'
stream.zig:26:53: note: error union payload 'u64' cannot cast into error union payload '?u64'
stream.zig:25:54: note: function return type declared here
stream.zig:332:70: note: called from here
How can this be? Doesn’t u64
coerce to ?u64
?