mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 22:33:08 +00:00
We already have a LICENSE file that covers the Zig Standard Library. We no longer need to remind everyone that the license is MIT in every single file. Previously this was introduced to clarify the situation for a fork of Zig that made Zig's LICENSE file harder to find, and replaced it with their own license that required annual payments to their company. However that fork now appears to be dead. So there is no need to reinforce the copyright notice in every single file.
36 lines
1.1 KiB
Zig
36 lines
1.1 KiB
Zig
const std = @import("../std.zig");
|
|
|
|
pub fn SeekableStream(
|
|
comptime Context: type,
|
|
comptime SeekErrorType: type,
|
|
comptime GetSeekPosErrorType: type,
|
|
comptime seekToFn: fn (context: Context, pos: u64) SeekErrorType!void,
|
|
comptime seekByFn: fn (context: Context, pos: i64) SeekErrorType!void,
|
|
comptime getPosFn: fn (context: Context) GetSeekPosErrorType!u64,
|
|
comptime getEndPosFn: fn (context: Context) GetSeekPosErrorType!u64,
|
|
) type {
|
|
return struct {
|
|
context: Context,
|
|
|
|
const Self = @This();
|
|
pub const SeekError = SeekErrorType;
|
|
pub const GetSeekPosError = GetSeekPosErrorType;
|
|
|
|
pub fn seekTo(self: Self, pos: u64) SeekError!void {
|
|
return seekToFn(self.context, pos);
|
|
}
|
|
|
|
pub fn seekBy(self: Self, amt: i64) SeekError!void {
|
|
return seekByFn(self.context, amt);
|
|
}
|
|
|
|
pub fn getEndPos(self: Self) GetSeekPosError!u64 {
|
|
return getEndPosFn(self.context);
|
|
}
|
|
|
|
pub fn getPos(self: Self) GetSeekPosError!u64 {
|
|
return getPosFn(self.context);
|
|
}
|
|
};
|
|
}
|