{"id":17128294,"url":"https://github.com/elinorbgr/token_store","last_synced_at":"2025-12-12T14:21:01.186Z","repository":{"id":57670036,"uuid":"106432559","full_name":"elinorbgr/token_store","owner":"elinorbgr","description":"A token-based store for abritraty types","archived":false,"fork":false,"pushed_at":"2017-10-12T19:26:51.000Z","size":557,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-25T14:00:43.337Z","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/elinorbgr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-10-10T15:02:22.000Z","updated_at":"2019-02-28T22:52:49.000Z","dependencies_parsed_at":"2022-09-26T20:40:43.536Z","dependency_job_id":null,"html_url":"https://github.com/elinorbgr/token_store","commit_stats":null,"previous_names":["vberger/token_store"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elinorbgr%2Ftoken_store","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elinorbgr%2Ftoken_store/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elinorbgr%2Ftoken_store/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elinorbgr%2Ftoken_store/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elinorbgr","download_url":"https://codeload.github.com/elinorbgr/token_store/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245206883,"owners_count":20577588,"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-10-14T19:06:42.303Z","updated_at":"2025-12-12T14:20:56.156Z","avatar_url":"https://github.com/elinorbgr.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![](http://meritbadge.herokuapp.com/token_store)](https://crates.io/crates/token_store)\n[![Build Status](https://travis-ci.org/vberger/token_store.svg?branch=master)](https://travis-ci.org/token_store)\n[![Coverage Status](https://coveralls.io/repos/github/vberger/token_store/badge.svg)](https://coveralls.io/github/vberger/token_store)\n\n# Token Store\n\nThis crate provides a simple token-based store for arbitrary types.\n\n## What is it for?\n\nThis crate was actually part of wayland-rs initially and extracted. The\nreason for its existence is the way these crates are designed, there is\nstrong separation of data vs logic.\n\nThis `token_store` works well in such configurations: you have a set of\nwell-separated modules that need to share data but don't need to access\nit conccurently. And also, the modules are not necessarily aware of each\nother (and so you can not really use a big fixed struct for storing all\nthe shared data.\n\nUsing `token_store`, at initialization each module will store the value it\nneeds in the store, and keep the tokens internally. It can optionnaly provide\nto the outside world tokens to access values that are to be shared.\n\nThen, when each module needs to do its work, it just needs a `\u0026mut Store`\nand can retrieve with its tokens the data it needs to work on, independently\nof what other modules may have stored in.\n\n## How do I use it?\n\n```rust\nuse token_store::Store;\n\n// create a store\nlet mut store = Store::new();\n\n// insert some things in it, you are given tokens\nlet token1 = store.insert(42);\n\n// you can store any type as log as it is `Any + 'static`\nlet token2 = store.insert(String::from(\"I like trains\"));\n\n// the tokens keep the information of the store type,\n// as such you don't need any annotation to retrieve a value:\nstore.get_mut(\u0026token2).push_str(\", and cars too!\");\n```\n\nThe retrieved tokens can be cloned and shared as you like between various\nparts of your code.\n\n\n## Documentation\n\nThe documentation for the master branch is [available online](https://vberger.github.io/token_store/).\n\nThe documentation for the releases can be found on [docs.rs](https://docs.rs/token_store):\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felinorbgr%2Ftoken_store","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felinorbgr%2Ftoken_store","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felinorbgr%2Ftoken_store/lists"}