Skip to content

Latest commit

 

History

History
48 lines (33 loc) · 1.57 KB

File metadata and controls

48 lines (33 loc) · 1.57 KB

Zig Itertools

zig build test

Warning

WORK IN PROGRESS

Implementation of some useful data structures in Zig. Inspired by Python's itertools module.

Implemented so far:

  • ChainIterator - "glues" two iterator in one, returns their elements in succession
  • SliceIterator - iterates over a slice
  • EmptyIterator - emits no elements. Implemented only for testing purposes.

Supported zig versions:

Version Support
0.14.0
0.14.1
0.15.1
0.15.2
0.16.0

Installation

  1. In the root directory of your project, run the following command to add zig_itertools to your build.zig.zon file (replace 0.0.1 with the latest release number):

    zig fetch --save https://github.com/insolor/zig-itertools/archive/refs/tags/0.0.1.zip

    Replace main in the URL with the tag you want to use.

  2. Add zig_itertools as a dependency module in your build.zig file, example:

    const zig_itertools = b.dependency("zig_itertools", .{});
    exe.root_module.addImport("zig_itertools", zig_itertools.module("zig_itertools"));

After that, you'll be able to import zig_itertools namespace from your code:

const zig_itertools = @import("zig_itertools");
const ChainIterator = zig_itertools.ChainIterator;