{"id":13998138,"url":"https://github.com/artichoke/intaglio","last_synced_at":"2026-05-22T01:06:57.461Z","repository":{"id":38985370,"uuid":"272076914","full_name":"artichoke/intaglio","owner":"artichoke","description":"🗃 UTF-8 string, byte string, and C string interner","archived":false,"fork":false,"pushed_at":"2025-03-25T00:11:06.000Z","size":2400,"stargazers_count":27,"open_issues_count":2,"forks_count":1,"subscribers_count":4,"default_branch":"trunk","last_synced_at":"2025-03-30T19:08:50.662Z","etag":null,"topics":["artichoke","bytes","interner","rust","rust-crate","string-interning","symbol","symbol-table","utf-8"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/intaglio","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/artichoke.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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":"2020-06-13T19:58:01.000Z","updated_at":"2025-03-03T23:48:54.000Z","dependencies_parsed_at":"2024-01-09T02:27:45.619Z","dependency_job_id":"93fb6e9f-a3ff-4cf7-bf3a-0e55d67b60c6","html_url":"https://github.com/artichoke/intaglio","commit_stats":{"total_commits":281,"total_committers":5,"mean_commits":56.2,"dds":"0.24199288256227758","last_synced_commit":"d1a5de10b29f3a0b966c698ece4e1c205cab7b62"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artichoke%2Fintaglio","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artichoke%2Fintaglio/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artichoke%2Fintaglio/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artichoke%2Fintaglio/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/artichoke","download_url":"https://codeload.github.com/artichoke/intaglio/tar.gz/refs/heads/trunk","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247543595,"owners_count":20955865,"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":["artichoke","bytes","interner","rust","rust-crate","string-interning","symbol","symbol-table","utf-8"],"created_at":"2024-08-09T19:01:25.392Z","updated_at":"2026-05-22T01:06:57.455Z","avatar_url":"https://github.com/artichoke.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# intaglio\n\n[![GitHub Actions](https://github.com/artichoke/intaglio/workflows/CI/badge.svg)](https://github.com/artichoke/intaglio/actions)\n[![Code Coverage](https://codecov.artichokeruby.org/intaglio/badges/flat.svg?nocache=2)](https://codecov.artichokeruby.org/intaglio/index.html)\n[![Twitter](https://img.shields.io/twitter/follow/artichokeruby?label=Follow\u0026style=social)](https://twitter.com/artichokeruby)\n\u003cbr\u003e\n[![Crate](https://img.shields.io/crates/v/intaglio.svg)](https://crates.io/crates/intaglio)\n[![API](https://docs.rs/intaglio/badge.svg)](https://docs.rs/intaglio)\n\nUTF-8 string and byte string interner and symbol table. Used to implement\nstorage for the [Ruby `Symbol`][symbol] table and the constant name table in\n[Artichoke Ruby][artichoke].\n\n\u003e Symbol objects represent names and some strings inside the Ruby interpreter.\n\u003e They are generated using the `:name` and `:\"string\"` literals syntax, and by\n\u003e the various `to_sym` methods. The same `Symbol` object will be created for a\n\u003e given name or string for the duration of a program's execution, regardless of\n\u003e the context or meaning of that name.\n\nIntaglio is a UTF-8 and byte string interner, which means it stores a single\ncopy of an immutable `\u0026str` or `\u0026[u8]` that can be referred to by a stable `u32`\ntoken.\n\nInterned strings and byte strings are cheap to compare and copy because they are\nrepresented as a `u32` integer.\n\n_Intaglio_ is an alternate name for an _engraved gem_, a gemstone that has been\ncarved with an image. The Intaglio crate is used to implement an immutable\nSymbol store in Artichoke Ruby.\n\n## Usage\n\nAdd this to your `Cargo.toml`:\n\n```toml\n[dependencies]\nintaglio = \"1.14.0\"\n```\n\nThen intern UTF-8 strings like:\n\n```rust\nfn intern_and_get() -\u003e Result\u003c(), Box\u003cdyn std::error::Error\u003e\u003e {\n    let mut table = intaglio::SymbolTable::new();\n    let name: \u0026'static str = \"abc\";\n    let sym = table.intern(name)?;\n    let retrieved = table.get(sym);\n    assert_eq!(Some(name), retrieved);\n    assert_eq!(sym, table.intern(\"abc\".to_string())?);\n    Ok(())\n}\n```\n\nOr intern byte strings like:\n\n```rust\nfn intern_and_get() -\u003e Result\u003c(), Box\u003cdyn std::error::Error\u003e\u003e {\n    let mut table = intaglio::bytes::SymbolTable::new();\n    let name: \u0026'static [u8] = b\"abc\";\n    let sym = table.intern(name)?;\n    let retrieved = table.get(sym);\n    assert_eq!(Some(name), retrieved);\n    assert_eq!(sym, table.intern(b\"abc\".to_vec())?);\n    Ok(())\n}\n```\n\nOr intern C strings like:\n\n```rust\nuse std::ffi::{CStr, CString};\n\nfn intern_and_get() -\u003e Result\u003c(), Box\u003cdyn std::error::Error\u003e\u003e {\n    let mut table = intaglio::cstr::SymbolTable::new();\n    let name: \u0026'static CStr = c\"abc\";\n    let sym = table.intern(name)?;\n    let retrieved = table.get(sym);\n    assert_eq!(Some(name), retrieved);\n    assert_eq!(sym, table.intern(CString::from(c\"abc\"))?);\n    Ok(())\n}\n```\n\nOr intern platform strings like:\n\n```rust\nuse std::ffi::{OsStr, OsString};\n\nfn intern_and_get() -\u003e Result\u003c(), Box\u003cdyn std::error::Error\u003e\u003e {\n    let mut table = intaglio::osstr::SymbolTable::new();\n    let name: \u0026'static OsStr = OsStr::new(\"abc\");\n    let sym = table.intern(name)?;\n    let retrieved = table.get(sym);\n    assert_eq!(Some(name), retrieved);\n    assert_eq!(sym, table.intern(OsString::from(\"abc\"))?);\n    Ok(())\n}\n```\n\nOr intern path strings like:\n\n```rust\nuse std::path::{Path, PathBuf};\n\nfn intern_and_get() -\u003e Result\u003c(), Box\u003cdyn std::error::Error\u003e\u003e {\n    let mut table = intaglio::path::SymbolTable::new();\n    let name: \u0026'static Path = Path::new(\"abc\");\n    let sym = table.intern(name)?;\n    let retrieved = table.get(sym);\n    assert_eq!(Some(name), retrieved);\n    assert_eq!(sym, table.intern(PathBuf::from(\"abc\"))?);\n    Ok(())\n}\n```\n\n## Implementation\n\nIntaglio interns owned and borrowed strings with no additional copying by\nleveraging `Cow` and a bit of unsafe code. CI runs `drop` tests under Miri and\nLeakSanitizer.\n\n## Crate features\n\nAll features are enabled by default.\n\n- **bytes** - Enables an additional symbol table implementation for interning\n  byte strings (`Vec\u003cu8\u003e` and `\u0026'static [u8]`).\n- **cstr** - Enables an additional symbol table implementation for interning C\n  strings (`CString` and `\u0026'static CStr`).\n- **osstr** - Enables an additional symbol table implementation for interning\n  platform strings (`OsString` and `\u0026'static OsStr`).\n- **path** - Enables an additional symbol table implementation for interning\n  path strings (`PathBuf` and `\u0026'static Path`).\n\n### Minimum Supported Rust Version\n\nThis crate requires at least Rust 1.85.0. This version can be bumped in minor\nreleases.\n\n## License\n\n`intaglio` is licensed under either of:\n\n- Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or\n  \u003chttp://www.apache.org/licenses/LICENSE-2.0\u003e)\n- MIT license ([LICENSE-MIT](LICENSE-MIT) or\n  \u003chttp://opensource.org/licenses/MIT\u003e)\n\n[symbol]: https://ruby-doc.org/core-3.1.2/Symbol.html\n[artichoke]: https://github.com/artichoke/artichoke\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fartichoke%2Fintaglio","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fartichoke%2Fintaglio","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fartichoke%2Fintaglio/lists"}