{"id":13741712,"url":"https://github.com/Hejsil/ziter","last_synced_at":"2025-05-08T22:31:52.696Z","repository":{"id":43412417,"uuid":"310081525","full_name":"Hejsil/ziter","owner":"Hejsil","description":"The missing iterators for Zig","archived":false,"fork":false,"pushed_at":"2025-05-08T07:10:56.000Z","size":133,"stargazers_count":76,"open_issues_count":1,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-08T08:24:03.624Z","etag":null,"topics":["functional","iterator","iterator-library","iterators","zig","zig-library","zig-package"],"latest_commit_sha":null,"homepage":"","language":"Zig","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Hejsil.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["Hejsil"]}},"created_at":"2020-11-04T18:10:36.000Z","updated_at":"2025-05-08T07:11:00.000Z","dependencies_parsed_at":"2024-01-02T08:02:21.720Z","dependency_job_id":"7fdcec32-af0e-4efc-abf9-f34b2f108745","html_url":"https://github.com/Hejsil/ziter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hejsil%2Fziter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hejsil%2Fziter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hejsil%2Fziter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hejsil%2Fziter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Hejsil","download_url":"https://codeload.github.com/Hejsil/ziter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253157954,"owners_count":21863200,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["functional","iterator","iterator-library","iterators","zig","zig-library","zig-package"],"created_at":"2024-08-03T04:01:01.998Z","updated_at":"2025-05-08T22:31:52.681Z","avatar_url":"https://github.com/Hejsil.png","language":"Zig","funding_links":["https://github.com/sponsors/Hejsil"],"categories":["Libraries"],"sub_categories":[],"readme":"# ziter\n\nAn iterator library for zig inspired by the iterators in the Rust standard libary.\n\n```zig\nconst iter = @import(\"ziter\");\nconst std = @import(\"std\");\n\ntest \"ascii\" {\n    const ascii_digits = iter.range(u8, 0, 255)\n        .filter({}, iter.void_ctx(std.ascii.isDigit));\n\n    const ascii_alpha = try iter.range(u8, 0, 255)\n        .filter({}, iter.void_ctx(std.ascii.isAlphabetic))\n        .collect_no_allocator(std.BoundedArray(u8, 255){});\n\n    try iter.expectEqual(iter.deref(\"0123456789\"), ascii_digits);\n    try std.testing.expectEqualStrings(\n        \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\",\n        ascii_alpha.slice(),\n    );\n}\n\ntest \"Fibonacci\" {\n    const fib = Fibonacci{};\n\n    const fib_sum_first_5 = fib.take(5).sum(usize);\n    const fib_first_alphabetic = fib.map({}, to_u8)\n        .find({}, iter.void_ctx(std.ascii.isAlphabetic));\n\n    try std.testing.expectEqual(@as(usize, 7), fib_sum_first_5);\n    try std.testing.expectEqual(@as(?u8, 'Y'), fib_first_alphabetic);\n}\n\npub const Fibonacci = struct {\n    c: usize = 0,\n    n: usize = 1,\n\n    pub fn next(it: *@This()) ?usize {\n        const curr = it.c;\n        it.c = it.n;\n        it.n = curr + it.n;\n        return curr;\n    }\n\n    pub usingnamespace iter;\n};\n\nfn to_u8(_: void, item: usize) u8 {\n    return @truncate(item);\n}\n\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FHejsil%2Fziter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FHejsil%2Fziter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FHejsil%2Fziter/lists"}