{"id":19880430,"url":"https://github.com/mrothnet/mr-ulid","last_synced_at":"2025-05-02T13:32:14.371Z","repository":{"id":260275633,"uuid":"880290455","full_name":"mrothNET/mr-ulid","owner":"mrothNET","description":"Robust and Hassle-Free ULIDs","archived":false,"fork":false,"pushed_at":"2025-02-22T01:33:22.000Z","size":54,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-28T02:38:28.562Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/mrothNET.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-10-29T13:14:50.000Z","updated_at":"2025-03-18T17:46:27.000Z","dependencies_parsed_at":"2025-02-13T04:24:07.131Z","dependency_job_id":"b49c8de1-dbd4-4899-b1cf-c9cc54b147ec","html_url":"https://github.com/mrothNET/mr-ulid","commit_stats":null,"previous_names":["mrothnet/mr-ulid"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrothNET%2Fmr-ulid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrothNET%2Fmr-ulid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrothNET%2Fmr-ulid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrothNET%2Fmr-ulid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrothNET","download_url":"https://codeload.github.com/mrothNET/mr-ulid/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252046253,"owners_count":21685980,"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":[],"created_at":"2024-11-12T17:11:19.516Z","updated_at":"2025-05-02T13:32:14.364Z","avatar_url":"https://github.com/mrothNET.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mr-ulid\n\n[![Crates.io](https://img.shields.io/crates/v/mr-ulid)](https://crates.io/crates/mr-ulid)\n[![Dependencies](https://deps.rs/repo/github/mrothNET/mr-ulid/status.svg)](https://deps.rs/repo/github/mrothNET/mr-ulid)\n[![License](https://img.shields.io/crates/l/mr-ulid)](https://github.com/mrothNET/mr-ulid/blob/main/LICENSE)\n[![Documentation](https://img.shields.io/docsrs/mr-ulid)](https://docs.rs/mr-ulid)\n\n**Robust and Hassle-Free ULIDs (Universally Unique Lexicographically Sortable Identifiers)**\n\n`mr-ulid` is designed with a focus on correctness and ease of use. It ensures that ULIDs generated are unique and strictly monotonically increasing.\nBy providing both `Ulid` and `ZeroableUlid` types, it serves different application needs, whether you require non-zero guarantees or need to handle zero ULIDs.\n\n## Key Features\n\n- **Robust**: Generates ULIDs that are unique and strictly monotonically increasing under all circumstances, including threads, no failing, and no overflowing random part. See below for [Details](#Guarantees).\n- **Hassle-Free**: Simple API for easy usage. Customize entropy source when needed.\n- **Non-Zero ULIDs**: Provides non-zero (`Ulid`) and zeroable (`ZeroableUlid`) types.\n- **Minimal Dependencies**: Actually no dependencies required, only `rand` enabled by default as Rust lacks a built-in random number generator.\n- **Optional Features**: Supports `serde` for serialization and deserialization.\n\n## Guarantees\n\nA notable guarantee of this crate is that a sufficient number of ULIDs can be generated at any time without failing or the random part overflowing.\n\nThe 80-bit random component of a ULID is slightly reduced by 10\u003csup\u003e10\u003c/sup\u003e values, resulting in a negligible reduction in entropy of approximately 0.000000000001%. This ensures that at least 10\u003csup\u003e10\u003c/sup\u003e ULIDs can be generated per _millisecond_, equating to 10\u003csup\u003e13\u003c/sup\u003e ULIDs per _second_. Such capacity exceeds the capabilities of current systems by magnitudes.\n\n## Installation\n\nAdd `mr-ulid` to your `Cargo.toml`:\n\n```toml\n[dependencies]\nmr-ulid = \"1\"\n```\n\n## Quickstart\n\n```rust\nuse mr_ulid::Ulid;\n\nfn main() {\n    // Generate a ULID\n    let u = Ulid::generate();\n\n    // Print a ULID\n    println!(\"Generated ULID: {u}\");\n\n    // Convert a ULID to a string\n    let s = ulid.to_string();\n\n    // Parse the string back into a ULID\n    let parsed: Ulid = s.parse().unwrap();\n\n    // Verify that the original and parsed ULIDs are the same\n    assert_eq!(u, parsed);\n}\n```\n\n### Serialization and Deserialization (JSON)\n\nTo enable serialization and deserialization, add `serde` and `serde_json` to your `Cargo.toml`, and enable the `serde` feature for `mr-ulid`:\n\n```toml\n[dependencies]\nserde = { version = \"1\", features = [\"derive\"] }\nserde_json = { version = \"1\" }\nmr-ulid = { version = \"1\", features = [\"serde\"] }\n```\n\n#### Example with `Serde`\n\n```rust\nuse mr_ulid::Ulid;\nuse serde::{Deserialize, Serialize};\n\n#[derive(Serialize, Deserialize, Debug, PartialEq)]\nstruct Example {\n    id: Ulid,\n    data: String,\n}\n\nfn main() {\n    let example = Example {\n        id: Ulid::generate(),\n        data: \"Hello, ULID!\".to_string(),\n    };\n\n    // Serialize to JSON\n    let json = serde_json::to_string(\u0026example).unwrap();\n    println!(\"Serialized JSON: {json}\");\n\n    // Deserialize back to struct\n    let deserialized: Example = serde_json::from_str(\u0026json).unwrap();\n\n    // Verify that the original and deserialized structs are the same\n    assert_eq!(example, deserialized);\n}\n```\n\n## Contributing\n\nContributions are welcome! Whether it's a bug fix, new feature, or improvement, your help is appreciated. Please feel free to open issues or submit pull requests on the [GitHub repository](https://github.com/mrothNET/mr-ulid).\n\n## License\n\nThis project is licensed under the [MIT License](https://github.com/mrothNET/mr-ulid/blob/main/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrothnet%2Fmr-ulid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrothnet%2Fmr-ulid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrothnet%2Fmr-ulid/lists"}