This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig library itself.
writeFile
Writer.writeFile
pubfnwriteFile(
w: *Writer,
/// Assumed to use `/` for any path separators.sub_path: []constu8,
file_reader: *Io.File.Reader,
/// If you want to match the file format's expectations, it wants number of/// seconds since POSIX epoch. Zero is also a great option here to make/// generated tarballs more reproducible.mtime: u64,
) WriteFileError!void
pubfnwriteFile(
w: *Writer,
/// Assumed to use `/` for any path separators.sub_path: []constu8,
file_reader: *Io.File.Reader,
/// If you want to match the file format's expectations, it wants number of/// seconds since POSIX epoch. Zero is also a great option here to make/// generated tarballs more reproducible.mtime: u64,
) WriteFileError!void {
constsize = tryfile_reader.getSize();
varheader: Header = .{};
tryw.setPath(&header, sub_path);
tryheader.setSize(size);
tryheader.setMtime(mtime);
tryheader.updateChecksum();
tryw.underlying_writer.writeAll(@ptrCast((&header)[0..1]));
_ = tryw.underlying_writer.sendFileAll(file_reader, .unlimited);
tryw.writePadding64(size);
}