{"id":20548075,"url":"https://github.com/lusingander/itsuki","last_synced_at":"2025-04-14T10:42:51.624Z","repository":{"id":229797198,"uuid":"777651853","full_name":"lusingander/itsuki","owner":"lusingander","description":"macro that defines a simple zero-based sequential enum ⭐️","archived":false,"fork":false,"pushed_at":"2024-05-11T06:30:02.000Z","size":17,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-08-17T11:11:01.719Z","etag":null,"topics":["enum","macros","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/lusingander.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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}},"created_at":"2024-03-26T09:04:40.000Z","updated_at":"2024-08-04T15:44:43.000Z","dependencies_parsed_at":"2024-03-26T10:27:14.266Z","dependency_job_id":"0721559b-e05e-4722-b774-d42c49dec639","html_url":"https://github.com/lusingander/itsuki","commit_stats":null,"previous_names":["lusingander/itsuki"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lusingander%2Fitsuki","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lusingander%2Fitsuki/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lusingander%2Fitsuki/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lusingander%2Fitsuki/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lusingander","download_url":"https://codeload.github.com/lusingander/itsuki/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248867509,"owners_count":21174748,"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":["enum","macros","rust"],"created_at":"2024-11-16T02:11:56.165Z","updated_at":"2025-04-14T10:42:51.595Z","avatar_url":"https://github.com/lusingander.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# itsuki\n\n[![Crate Status](https://img.shields.io/crates/v/itsuki.svg)](https://crates.io/crates/itsuki)\n\nmacro that defines a simple zero-based sequential enum ⭐️\n\n## Usage\n\n### Function-like\n\n```rs\nuse itsuki::define_zero_indexed_enum;\n\ndefine_zero_indexed_enum! {\n    Quintuplets =\u003e [Ichika, Nino, Miku, Yotsuba, Itsuki]\n}\n\nlet miku = Quintuplets::Miku;\n\nassert_eq!(miku, Quintuplets::Miku);\nassert_ne!(miku, Quintuplets::Nino);\n\nassert_eq!(Quintuplets::len(), 5);\n\nuse Quintuplets::*;\n\nassert_eq!(Quintuplets::vars_vec(), vec![Ichika, Nino, Miku, Yotsuba, Itsuki]);\nassert_eq!(Quintuplets::vars_array(), [Ichika, Nino, Miku, Yotsuba, Itsuki]);\n\nassert_eq!(Nino.next(), Miku);\nassert_eq!(Itsuki.next(), Ichika);\n\nassert_eq!(Yotsuba.prev(), Miku);\nassert_eq!(Ichika.prev(), Itsuki);\n\nassert_eq!(Ichika.next_in(|q| [Miku, Yotsuba].contains(\u0026q)), Miku);\nassert_eq!(Miku.next_in(|q| [Miku, Yotsuba].contains(\u0026q)), Yotsuba);\n\nassert_eq!(Nino.prev_in(|q| [Miku, Yotsuba].contains(\u0026q)), Yotsuba);\nassert_eq!(Yotsuba.prev_in(|q| [Miku, Yotsuba].contains(\u0026q)), Miku);\n\nassert_eq!(Miku.val(), 2);\nassert_eq!(Yotsuba.val(), 3);\n\nassert_eq!(Quintuplets::try_from(0), Ok(Ichika));\nassert_eq!(Quintuplets::try_from(4), Ok(Itsuki));\nassert_eq!(Quintuplets::try_from(5), Err(()));\n\nassert_eq!(1.try_into(), Ok(Nino));\nassert_eq!(3.try_into(), Ok(Yotsuba));\n```\n\n### Derive\n\n```rs\nuse itsuki::ZeroIndexedEnum;\n\n#[derive(ZeroIndexedEnum, Debug, Clone, Copy, PartialEq, Eq)]\nenum Quintuplets {\n    Ichika,\n    Nino,\n    Miku,\n    Yotsuba,\n    Itsuki,\n}\n```\n\n### Attribute\n\n```rs\nuse itsuki::zero_indexed_enum;\n\n#[zero_indexed_enum]\nenum Quintuplets {\n    Ichika,\n    Nino,\n    Miku,\n    Yotsuba,\n    Itsuki,\n}\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flusingander%2Fitsuki","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flusingander%2Fitsuki","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flusingander%2Fitsuki/lists"}