Zig Serialization provides an easy to use interface to portably serialize and deserialize binary data to and from std readers and writers.
This library is based on the now-removed io.serialization API from the zig standard library. You can find the original code here in the ziglang/std-lib-orphanage repository.
To add this library as a dependency, run the following in your build folder:
zig fetch git+https://github.com/SeanTheGleaming/zig-serialization --save=serializationpubfnbuild(b: *std.Build) void {
constserialization_dep=b.dependency("serialization", .{});
constserialization_module=serialization_dep.module("serialization");
// Adding to a compile step (executable, library, or unit test)constexe: *std.Build.Step.Compile=...;
exe.root_module.addImport("serialization", serialization_module);
// Adding to a moduleconstmodule: *std.Build.Module=...;
module.addImport("serialization", serialization_module);
}To import the library in your Zig source code, use @import("serialization")
To see documentation, you can clone this repo and generate documenation with zig build doc