{"id":15647478,"url":"https://github.com/ericlbuehler/trc","last_synced_at":"2025-04-14T03:34:04.439Z","repository":{"id":174534375,"uuid":"652371614","full_name":"EricLBuehler/trc","owner":"EricLBuehler","description":"A faster Arc.","archived":false,"fork":false,"pushed_at":"2024-02-08T13:25:04.000Z","size":509,"stargazers_count":58,"open_issues_count":0,"forks_count":6,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-27T17:36:07.802Z","etag":null,"topics":["reference-counting","rust","smart-pointers"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/trc","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/EricLBuehler.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":"2023-06-11T23:36:55.000Z","updated_at":"2025-03-14T05:58:20.000Z","dependencies_parsed_at":"2024-02-08T14:49:16.710Z","dependency_job_id":null,"html_url":"https://github.com/EricLBuehler/trc","commit_stats":null,"previous_names":["ericlbuehler/trc"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EricLBuehler%2Ftrc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EricLBuehler%2Ftrc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EricLBuehler%2Ftrc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EricLBuehler%2Ftrc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EricLBuehler","download_url":"https://codeload.github.com/EricLBuehler/trc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248815740,"owners_count":21165975,"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":["reference-counting","rust","smart-pointers"],"created_at":"2024-10-03T12:19:35.620Z","updated_at":"2025-04-14T03:34:04.413Z","avatar_url":"https://github.com/EricLBuehler.png","language":"Rust","readme":"# Trc\n[![MIT License](https://img.shields.io/badge/License-MIT-informational)](LICENSE)\n![Build status](https://github.com/EricLBuehler/trc/actions/workflows/build.yml/badge.svg)\n![Docs status](https://github.com/EricLBuehler/trc/actions/workflows/docs.yml/badge.svg)\n![Tests status](https://github.com/EricLBuehler/trc/actions/workflows/tests.yml/badge.svg)\n\n`Trc` is a performant heap-allocated smart pointer for Rust that implements thread reference counting.\n`Trc` stands for: Thread Reference Counted.\n`Trc` provides a shared ownership of the data similar to `Arc\u003cT\u003e` and `Rc\u003cT\u003e`.\nIt implements thread reference counting, which is based on the observation that most objects are only used by one thread.\nThis means that two reference counts can be created: one for thread-local use, and one atomic one for sharing between threads.\nThread reference counting sets the atomic reference count to the number of threads using the data.\n\nA cycle between `Trc` pointers cannot be deallocated as the reference counts will never reach zero. The solution is a `Weak\u003cT\u003e`.\nA `Weak\u003cT\u003e` is a non-owning reference to the data held by a `Trc\u003cT\u003e`.\nThey break reference cycles by adding a layer of indirection and act as an observer. They cannot access the data directly, and\nmust be converted back into a `Trc`. `Weak` does not keep the value alive (which can be dropped), and only keeps the backing allocation alive.\n\nTo soundly implement thread safety `Trc` is `!Send` and `!Sync`. To solve this, `Trc` introduces a `SharedTrc\u003cT\u003e`, which is `Send` and `Sync`.\n`SharedTrc` is the only way to safely send a `Trc`'s data across threads without using a `Weak`.\nSee `SharedTrc` for it's API, which is similar to that of `Weak`.\n\nBecause `Trc` is not part of the standard library, the `CoerceUnsized` and `Receiver` traits cannot currently be implemented by default. However, `Trc` provides `dyn_unstable` trait which enables the above traits for `Trc` and `SharedTrc` and must be used with nightly Rust (`cargo +nightly ...`).\n\n## Examples\nSee examples [here](EXAMPLES.md).\n\n## Benchmarks \n\nClick [here](BENCHMARKS.md) for more benchmarks. Multiple different operating systems, CPUs, and architectures are tested. \n\n![Trc vs Arc performance](./figures/performance.png)\n\n## Use\nTo use `Trc`, simply run `cargo add trc`, or add `trc = \"1.2.3\"`. Optionally, you can always use the latest version by adding `trc = {git = \"https://github.com/EricLBuehler/trc.git\"}`.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fericlbuehler%2Ftrc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fericlbuehler%2Ftrc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fericlbuehler%2Ftrc/lists"}