Zig 0.17.0-dev (Split by item)

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.

getAniheaderFlags

ani.getAniheaderFlags
fn getAniheaderFlags(reader: *std.Io.Reader) !u32

File

Code

fn getAniheaderFlags(reader: *std.Io.Reader) !u32 {
    const riff_header = try reader.takeArray(4);
    if (!std.mem.eql(u8, riff_header, "RIFF")) return error.InvalidFormat;

    _ = try reader.takeInt(u32, .little); // size of RIFF chunk

    const form_type = try reader.takeArray(4);
    if (!std.mem.eql(u8, form_type, "ACON")) return error.InvalidFormat;

    while (true) {
        const chunk_id = try reader.takeArray(4);
        const chunk_len = try reader.takeInt(u32, .little);
        if (!std.mem.eql(u8, chunk_id, "anih")) {
            // TODO: Move file cursor instead of skipBytes
            try reader.discardAll(chunk_len);
            continue;
        }

        const aniheader = try reader.takeStruct(ANIHEADER, .little);
        return aniheader.flags;
    }
}