Further work on getting everything working again

Mainly working on decompression interface
This commit is contained in:
Caleb Gardner
2026-04-30 07:00:46 -05:00
parent b67d02074d
commit 274d088490
4 changed files with 106 additions and 17 deletions
+19
View File
@@ -0,0 +1,19 @@
//! A decompression interface
const std = @import("std");
const Decompressor = @This();
pub const Error = std.Io.Reader.StreamError || std.mem.Allocator.Error;
/// The actual decompression function.
/// If the given decompressor is null, then the decompression should be done "stateless" without lasting allocations.
decomp_fn: *fn (?*Decompressor, std.mem.Allocator, in: []u8, out: []u8) Error!usize,
pub fn Decompress(self: *Decompressor, alloc: std.mem.Allocator, in: []u8, out: []u8) Error!usize {
return self.decomp_fn(self, alloc, in, out);
}
pub fn StatelessDecompression(self: Decompressor, alloc: std.mem.Allocator, in: []u8, out: []u8) Error!usize {
return self.decomp_fn(null, alloc, in, out);
}