{"id":13648722,"url":"https://github.com/servo/string-cache","last_synced_at":"2025-04-22T11:32:59.243Z","repository":{"id":18010749,"uuid":"21033053","full_name":"servo/string-cache","owner":"servo","description":"String interning for Rust","archived":false,"fork":false,"pushed_at":"2025-03-28T03:14:42.000Z","size":656,"stargazers_count":199,"open_issues_count":18,"forks_count":79,"subscribers_count":20,"default_branch":"main","last_synced_at":"2025-04-22T03:35:18.341Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/servo.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,"zenodo":null}},"created_at":"2014-06-20T09:44:33.000Z","updated_at":"2025-04-11T19:29:14.000Z","dependencies_parsed_at":"2025-02-16T13:11:23.188Z","dependency_job_id":"550c3cb4-8720-4ea3-a1a9-dde8f9585e59","html_url":"https://github.com/servo/string-cache","commit_stats":{"total_commits":381,"total_committers":65,"mean_commits":5.861538461538461,"dds":0.7375328083989501,"last_synced_commit":"471ca0d8978cf6ce7dbfd170e67a103cfe62b975"},"previous_names":[],"tags_count":46,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/servo%2Fstring-cache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/servo%2Fstring-cache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/servo%2Fstring-cache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/servo%2Fstring-cache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/servo","download_url":"https://codeload.github.com/servo/string-cache/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250232443,"owners_count":21396643,"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-08-02T01:04:28.936Z","updated_at":"2025-04-22T11:32:58.900Z","avatar_url":"https://github.com/servo.png","language":"Rust","readme":"# string-cache\n\n[![Build Status](https://github.com/servo/string-cache/actions/workflows/ci.yml/badge.svg)](https://github.com/servo/string-cache/actions)\n\n[Documentation](https://docs.rs/string_cache/)\n\nA string interning library for Rust, developed as part of the [Servo](https://github.com/servo/servo) project.\n\n## Simple usage\n\nIn `Cargo.toml`:\n\n```toml\n[dependencies]\nstring_cache = \"0.8\"\n```\n\nIn `lib.rs`:\n\n```rust\nextern crate string_cache;\nuse string_cache::DefaultAtom as Atom;\n```\n\n## With static atoms\n\nIn `Cargo.toml`:\n\n```toml\n[package]\nbuild = \"build.rs\"\n\n[dependencies]\nstring_cache = \"0.8\"\n\n[build-dependencies]\nstring_cache_codegen = \"0.5\"\n```\n\nIn `build.rs`:\n\n```rust\nextern crate string_cache_codegen;\n\nuse std::env;\nuse std::path::Path;\n\nfn main() {\n    string_cache_codegen::AtomType::new(\"foo::FooAtom\", \"foo_atom!\")\n        .atoms(\u0026[\"foo\", \"bar\"])\n        .write_to_file(\u0026Path::new(\u0026env::var(\"OUT_DIR\").unwrap()).join(\"foo_atom.rs\"))\n        .unwrap()\n}\n```\n\nIn `lib.rs`:\n\n```rust\nextern crate string_cache;\n\nmod foo {\n    include!(concat!(env!(\"OUT_DIR\"), \"/foo_atom.rs\"));\n}\n```\n\nThe generated code will define a `FooAtom` type and a `foo_atom!` macro.\nThe macro can be used in expression or patterns, with strings listed in `build.rs`.\nFor example:\n\n```rust\nfn compute_something(input: \u0026foo::FooAtom) -\u003e u32 {\n    match *input {\n        foo_atom!(\"foo\") =\u003e 1,\n        foo_atom!(\"bar\") =\u003e 2,\n        _ =\u003e 3,\n    }\n}\n```\n","funding_links":[],"categories":["Rust"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fservo%2Fstring-cache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fservo%2Fstring-cache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fservo%2Fstring-cache/lists"}