{"id":15994665,"url":"https://github.com/taiki-e/iter-enum","last_synced_at":"2025-03-16T07:32:04.049Z","repository":{"id":45078005,"uuid":"168919183","full_name":"taiki-e/iter-enum","owner":"taiki-e","description":"#[derive(Iterator, DoubleEndedIterator, ExactSizeIterator, FusedIterator, Extend)] for enums.","archived":false,"fork":false,"pushed_at":"2024-10-20T18:32:07.000Z","size":256,"stargazers_count":14,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-10-20T22:57:54.909Z","etag":null,"topics":["no-std","proc-macro","rust"],"latest_commit_sha":null,"homepage":"https://docs.rs/iter-enum","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/taiki-e.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE-APACHE","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":"taiki-e"}},"created_at":"2019-02-03T07:04:49.000Z","updated_at":"2024-10-20T18:32:11.000Z","dependencies_parsed_at":"2023-02-15T10:30:59.764Z","dependency_job_id":"9f7b7f98-dffd-491f-8b53-60cbed5d9bb5","html_url":"https://github.com/taiki-e/iter-enum","commit_stats":{"total_commits":293,"total_committers":2,"mean_commits":146.5,"dds":"0.0034129692832765013","last_synced_commit":"085502a2feff5ab1f6a1b306e13ecb845b0b782d"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taiki-e%2Fiter-enum","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taiki-e%2Fiter-enum/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taiki-e%2Fiter-enum/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taiki-e%2Fiter-enum/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/taiki-e","download_url":"https://codeload.github.com/taiki-e/iter-enum/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243806045,"owners_count":20350775,"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":["no-std","proc-macro","rust"],"created_at":"2024-10-08T07:09:42.648Z","updated_at":"2025-03-16T07:32:04.040Z","avatar_url":"https://github.com/taiki-e.png","language":"Shell","readme":"# iter-enum\n\n[![crates.io](https://img.shields.io/crates/v/iter-enum?style=flat-square\u0026logo=rust)](https://crates.io/crates/iter-enum)\n[![docs.rs](https://img.shields.io/badge/docs.rs-iter--enum-blue?style=flat-square\u0026logo=docs.rs)](https://docs.rs/iter-enum)\n[![license](https://img.shields.io/badge/license-Apache--2.0_OR_MIT-blue?style=flat-square)](#license)\n[![msrv](https://img.shields.io/badge/msrv-1.56-blue?style=flat-square\u0026logo=rust)](https://www.rust-lang.org)\n[![github actions](https://img.shields.io/github/actions/workflow/status/taiki-e/iter-enum/ci.yml?branch=main\u0026style=flat-square\u0026logo=github)](https://github.com/taiki-e/iter-enum/actions)\n\n\u003c!-- tidy:sync-markdown-to-rustdoc:start:src/lib.rs --\u003e\n\n\\#\\[derive(Iterator, DoubleEndedIterator, ExactSizeIterator, FusedIterator, Extend)\\] for enums.\n\n## Usage\n\nAdd this to your `Cargo.toml`:\n\n```toml\n[dependencies]\niter-enum = \"1\"\n```\n\n## Examples\n\n```rust\nuse iter_enum::*;\n\n#[derive(Iterator, DoubleEndedIterator, ExactSizeIterator, FusedIterator, Extend)]\nenum Either\u003cA, B\u003e {\n    A(A),\n    B(B),\n}\n\nfn foo(x: i32) -\u003e impl Iterator\u003cItem = i32\u003e {\n    if x \u003e 0 {\n        Either::A(x..=0)\n    } else {\n        Either::B(Some(x).into_iter())\n    }\n}\n```\n\nSee [auto_enums] crate for how to automate patterns like this.\n\n## Supported traits\n\n- [`Iterator`](https://doc.rust-lang.org/std/iter/trait.Iterator.html) - [example](https://github.com/taiki-e/iter-enum/blob/HEAD/tests/expand/iterator.rs) | [generated code](https://github.com/taiki-e/iter-enum/blob/HEAD/tests/expand/iterator.expanded.rs)\n- [`DoubleEndedIterator`](https://doc.rust-lang.org/std/iter/trait.DoubleEndedIterator.html) - [example](https://github.com/taiki-e/iter-enum/blob/HEAD/tests/expand/double_ended_iterator.rs) | [generated code](https://github.com/taiki-e/iter-enum/blob/HEAD/tests/expand/double_ended_iterator.expanded.rs)\n- [`ExactSizeIterator`](https://doc.rust-lang.org/std/iter/trait.ExactSizeIterator.html) - [example](https://github.com/taiki-e/iter-enum/blob/HEAD/tests/expand/exact_size_iterator.rs) | [generated code](https://github.com/taiki-e/iter-enum/blob/HEAD/tests/expand/exact_size_iterator.expanded.rs)\n- [`FusedIterator`](https://doc.rust-lang.org/std/iter/trait.FusedIterator.html) - [example](https://github.com/taiki-e/iter-enum/blob/HEAD/tests/expand/fused_iterator.rs) | [generated code](https://github.com/taiki-e/iter-enum/blob/HEAD/tests/expand/fused_iterator.expanded.rs)\n- [`Extend`](https://doc.rust-lang.org/std/iter/trait.Extend.html) - [example](https://github.com/taiki-e/iter-enum/blob/HEAD/tests/expand/extend.rs) | [generated code](https://github.com/taiki-e/iter-enum/blob/HEAD/tests/expand/extend.expanded.rs)\n- [`ParallelIterator`](https://docs.rs/rayon/latest/rayon/iter/trait.ParallelIterator.html) (*requires `\"rayon\"` feature*) - [example](https://github.com/taiki-e/iter-enum/blob/HEAD/tests/expand/parallel_iterator.rs) | [generated code](https://github.com/taiki-e/iter-enum/blob/HEAD/tests/expand/parallel_iterator.expanded.rs)\n- [`IndexedParallelIterator`](https://docs.rs/rayon/latest/rayon/iter/trait.IndexedParallelIterator.html) (*requires `\"rayon\"` feature*) - [example](https://github.com/taiki-e/iter-enum/blob/HEAD/tests/expand/indexed_parallel_iterator.rs) | [generated code](https://github.com/taiki-e/iter-enum/blob/HEAD/tests/expand/indexed_parallel_iterator.expanded.rs)\n- [`ParallelExtend`](https://docs.rs/rayon/latest/rayon/iter/trait.ParallelExtend.html) (*requires `\"rayon\"` feature*) - [example](https://github.com/taiki-e/iter-enum/blob/HEAD/tests/expand/parallel_extend.rs) | [generated code](https://github.com/taiki-e/iter-enum/blob/HEAD/tests/expand/parallel_extend.expanded.rs)\n\n## Optional features\n\n- **`rayon`**\n  - Enable to use `#[derive(ParallelIterator, IndexedParallelIterator, ParallelExtend)]`.\n\n## Related Projects\n\n- [auto_enums]: A library for to allow multiple return types by automatically generated enum.\n- [derive_utils]: A procedural macro helper for easily writing [derives macros][proc-macro-derive] for enums.\n- [io-enum]: \\#\\[derive(Read, Write, Seek, BufRead)\\] for enums.\n\n[auto_enums]: https://github.com/taiki-e/auto_enums\n[derive_utils]: https://github.com/taiki-e/derive_utils\n[io-enum]: https://github.com/taiki-e/io-enum\n[proc-macro-derive]: https://doc.rust-lang.org/reference/procedural-macros.html#derive-macros\n\n\u003c!-- tidy:sync-markdown-to-rustdoc:end --\u003e\n\n## License\n\nLicensed under either of [Apache License, Version 2.0](LICENSE-APACHE) or\n[MIT license](LICENSE-MIT) at your option.\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you, as defined in the Apache-2.0 license, shall\nbe dual licensed as above, without any additional terms or conditions.\n","funding_links":["https://github.com/sponsors/taiki-e"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaiki-e%2Fiter-enum","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftaiki-e%2Fiter-enum","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaiki-e%2Fiter-enum/lists"}