{"id":31897311,"url":"https://github.com/johnnynotsolucky/strong_id","last_synced_at":"2025-10-13T11:19:25.290Z","repository":{"id":180500787,"uuid":"665226641","full_name":"johnnynotsolucky/strong_id","owner":"johnnynotsolucky","description":"Strongly typed IDs","archived":false,"fork":false,"pushed_at":"2024-05-17T20:33:25.000Z","size":77,"stargazers_count":10,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-19T16:21:59.494Z","etag":null,"topics":["base32","typeid","uuid"],"latest_commit_sha":null,"homepage":"https://docs.rs/strong_id","language":"Rust","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/johnnynotsolucky.png","metadata":{"files":{"readme":"README.md","changelog":null,"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}},"created_at":"2023-07-11T18:14:27.000Z","updated_at":"2024-09-03T05:27:51.000Z","dependencies_parsed_at":"2024-05-17T21:29:59.553Z","dependency_job_id":"f9d1622d-8727-41c3-9439-4ddf1ac3dbf3","html_url":"https://github.com/johnnynotsolucky/strong_id","commit_stats":null,"previous_names":["johnnynotsolucky/strong_id"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/johnnynotsolucky/strong_id","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnnynotsolucky%2Fstrong_id","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnnynotsolucky%2Fstrong_id/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnnynotsolucky%2Fstrong_id/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnnynotsolucky%2Fstrong_id/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/johnnynotsolucky","download_url":"https://codeload.github.com/johnnynotsolucky/strong_id/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnnynotsolucky%2Fstrong_id/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279014768,"owners_count":26085594,"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","status":"online","status_checked_at":"2025-10-13T02:00:06.723Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["base32","typeid","uuid"],"created_at":"2025-10-13T11:19:21.596Z","updated_at":"2025-10-13T11:19:25.282Z","avatar_url":"https://github.com/johnnynotsolucky.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `strong_id`\n\n[\u003cimg alt=\"github\" src=\"https://img.shields.io/badge/johnnynotsolucky/strong_id-8da0cb?style=for-the-badge\u0026labelColor=555555\u0026logo=github\" height=\"20\"\u003e](https://github.com/johnnynotsolucky/strong_id)\n[\u003cimg alt=\"crates.io\" src=\"https://img.shields.io/crates/v/strong_id.svg?style=for-the-badge\u0026color=fc8d62\u0026logo=rust\" height=\"20\"\u003e](https://crates.io/crates/strong_id)\n[\u003cimg alt=\"docs.rs\" src=\"https://img.shields.io/badge/docs.rs-strong_id-66c2a5?style=for-the-badge\u0026labelColor=555555\u0026logo=docs.rs\" height=\"20\"\u003e](https://docs.rs/strong_id)\n[\u003cimg alt=\"ci status\" src=\"https://img.shields.io/github/actions/workflow/status/johnnynotsolucky/strong_id/ci.yaml?branch=main\u0026style=for-the-badge\u0026label=CI\" height=\"20\"\u003e](https://github.com/johnnynotsolucky/strong_id/actions/workflows/ci.yaml)\n[\u003cimg alt=\"typeid spec status\" src=\"https://img.shields.io/github/actions/workflow/status/johnnynotsolucky/strong_id/typeid_spec.yaml?branch=main\u0026style=for-the-badge\u0026label=TypeID\" height=\"20\"\u003e](https://github.com/johnnynotsolucky/strong_id/actions/workflows/typeid_spec.yaml)\n\nStrongly typed IDs which optionally satisfy the [TypeID](https://github.com/jetpack-io/typeid) specification.\n\nA StrongId is any type which implements `StrongId\u003cT: Id\u003e`. \n\nThe `Id` trait is implemented for `u8`, `u16`, `u32`, `u64`, `u128`, `usize` and when the `\"uuid\"` feature is enabled, \n`Uuid`.\n\n\n## TypeID\n\nWith `default-features = false` and the `typeid` feature enabled, StrongID will follow the TypeID specification. \n\nStrongID is verified against the TypeID spec with the \n[typeid](https://github.com/johnnynotsolucky/strong_id/actions/workflows/typeid_spec.yaml) workflow every 6 hours.\n\n## Examples\n\n### Dynamic StrongIds\n\n#### ID with a prefix\n```rust\nuse strong_id::{prefix, DynamicStrongId};\n\nlet user_id = DynamicStrongId::\u003cu16\u003e::new(prefix!(\"user\"), 3203).unwrap();\nprintln!(\"{}\", user_id); // user_0343\n\nlet user_id = \"user_0343\".parse::\u003cDynamicStrongId\u003cu16\u003e\u003e().unwrap();\nprintln!(\"{:#?}\", user_id);\n// DynamicStrongId {\n//     prefix: Some(\n//        Prefix {\n//           inner: \"user\",\n//        },\n//     ),\n//     suffix: 3203,\n// }\n```\n\n#### ID without a prefix\n```rust\nuse strong_id::{prefix, DynamicStrongId};\n\nlet id = DynamicStrongId::\u003cu16\u003e::new_plain(3203);\nprintln!(\"{}\", id); // 0343\n\nlet id = \"0343\".parse::\u003cDynamicStrongId\u003cu16\u003e\u003e().unwrap();\nprintln!(\"{:#?}\", id);\n// DynamicStrongId {\n//     prefix: None,\n//     suffix: 3203,\n// }\n```\n\n#### TypeId with a prefix\n\n```rust\nuse strong_id::{prefix, DynamicStrongId};\n\nlet user_id = DynamicStrongId::\u003cUuid\u003e::now_v7(prefix!(\"user\")).unwrap();\nprintln!(\"{}\", user_id); // user_01h536gfwffx2rm6pa0xg63337\n\nlet user_id = \"user_01h536gfwffx2rm6pa0xg63337\"\n  .parse::\u003cDynamicStrongId\u003cUuid\u003e\u003e()\n  .unwrap();\nprintln!(\"{:#?}\", user_id);\n// DynamicStrongId {\n//     prefix: Some(\n//        Prefix {\n//           inner: \"user\",\n//        },\n//     ),\n//     suffix: 01894668-3f8f-7f45-8a1a-ca0760618c67,\n// }\n```\n\n#### TypeId without a prefix\n\n```rust\nuse strong_id::{prefix, DynamicStrongId};\n\nlet id = DynamicStrongId::\u003cUuid\u003e::now_v7_plain();\nprintln!(\"{}\", id); // 01h536gfwffx2rm6pa0xg63337\n\nlet id = \"01h536gfwffx2rm6pa0xg63337\"\n  .parse::\u003cDynamicStrongId\u003cUuid\u003e\u003e()\n  .unwrap();\nprintln!(\"{:#?}\", id);\n// DynamicStrongId {\n//     prefix: None,\n//     suffix: 01894668-3f8f-7f45-8a1a-ca0760618c67,\n// }\n```\n\n### Generated StrongIds\n\n#### ID with a prefix\n```rust\nuse strong_id::strong_id;\n\nstrong_id!(pub struct UserId(u16 =\u003e \"user\"));\n\nlet user_id = UserId::from(3203);\nprintln!(\"{}\", user_id); // user_0343\n\nlet user_id = \"user_0343\".parse::\u003cUserId\u003e().unwrap();\nprintln!(\"{:#?}\", user_id);\n// UserId {\n//     suffix: 3203,\n// }\n```\n\n#### ID without a prefix\n\n```rust\nuse strong_id::strong_id;\n\nstrong_id!(pub struct Id(u16));\n\nlet id = Id::from(3203);\nprintln!(\"{}\", id); // user_0343\n\nlet id = \"0343\".parse::\u003cId\u003e().unwrap();\nprintln!(\"{:#?}\", id);\n// Id {\n//     suffix: 3203,\n// }\n```\n\n#### Generated TypeId with a prefix\n\n```rust\nuse strong_id::{strong_uuid, StrongUuid};\n\nstrong_uuid!(pub struct UserId(pub Uuid =\u003e \"user\"));\n// strong_uuid!(struct UserId(Uuid =\u003e \"user\"));\n/*\nstrong_id! {\n    #[derive(StrongUuid)]\n    pub struct UserId(pub Uuid =\u003e \"user\")    \n}\n*/\n\nlet user_id = UserId::now_v7();\nprintln!(\"{}\", user_id); // user_01h536z8abez196j2nzz06y8c8\n\nlet user_id = \"user_01h536z8abez196j2nzz06y8c8\".parse::\u003cUserId\u003e().unwrap();\nprintln!(\"{:#?}\", user_id);\n// UserId {\n//     suffix: 0189466f-a14b-77c2-9348-55ffc06f2188,\n// }\n```\n\n#### Generated TypeId without a prefix\n\n```rust\nuse strong_id::{strong_uuid, StrongUuid};\n\nstrong_uuid!(pub struct Id(pub Uuid));\n// strong_uuid!(struct Id(Uuid));\n/*\nstrong_id! {\n    #[derive(StrongUuid)]\n    pub struct Id(pub Uuid)    \n}\n*/\n\nlet id = Id::now_v7();\nprintln!(\"{}\", id); // 01h5372sq2egxb6ps3taq7p6np\n\nlet id = \"01h5372sq2egxb6ps3taq7p6np\".parse::\u003cId\u003e().unwrap();\nprintln!(\"{:#?}\", id);\n// UserId {\n//     suffix: 01894671-66e2-743a-b35b-23d2ae7b1ab6,\n// }\n```\n\n## Features\n\n- `delimited` - Enables underscore delimited prefixes. On by default.\n- `serde` - Enables serde support in code generation.\n- `uuid` - Enable uuid functionality.\n  - `uuid-v1` - corresponds with uuid \"v1\" feature\n  - `uuid-v3` - corresponds with uuid \"v3\" feature\n  - `uuid-v4` - corresponds with uuid \"v4\" feature\n  - `uuid-v5` - corresponds with uuid \"v5\" feature\n  - `uuid-v6` - corresponds with uuid \"v6\" feature\n  - `uuid-v7` - corresponds with uuid \"v7\" feature\n  - `uuid-v8` - corresponds with uuid \"v8\" feature\n- `typeid` - Enable features which satisfy the TypeId specification.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnnynotsolucky%2Fstrong_id","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjohnnynotsolucky%2Fstrong_id","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnnynotsolucky%2Fstrong_id/lists"}