{"id":15408736,"url":"https://github.com/darthbenro008/thread-broadcaster","last_synced_at":"2025-04-19T03:12:12.920Z","repository":{"id":174804134,"uuid":"652807196","full_name":"DarthBenro008/thread-broadcaster","owner":"DarthBenro008","description":"A SPMC (Single Producer Multi Consumer) broadcasting channel to broadcast notifications between threads","archived":false,"fork":false,"pushed_at":"2023-06-12T20:59:02.000Z","size":8,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-23T20:55:05.898Z","etag":null,"topics":["channel","concurrency","mpmc","rust","spmc"],"latest_commit_sha":null,"homepage":"https://docs.rs/thread-broadcaster/latest/thread_broadcaster/","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/DarthBenro008.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-12T20:50:47.000Z","updated_at":"2024-04-03T16:45:24.000Z","dependencies_parsed_at":"2023-07-02T23:46:32.857Z","dependency_job_id":null,"html_url":"https://github.com/DarthBenro008/thread-broadcaster","commit_stats":null,"previous_names":["darthbenro008/thread-broadcaster"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DarthBenro008%2Fthread-broadcaster","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DarthBenro008%2Fthread-broadcaster/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DarthBenro008%2Fthread-broadcaster/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DarthBenro008%2Fthread-broadcaster/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DarthBenro008","download_url":"https://codeload.github.com/DarthBenro008/thread-broadcaster/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241385625,"owners_count":19954586,"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":["channel","concurrency","mpmc","rust","spmc"],"created_at":"2024-10-01T16:35:00.113Z","updated_at":"2025-03-01T15:30:56.932Z","avatar_url":"https://github.com/DarthBenro008.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# thread-broadcaster\n\n![release](https://img.shields.io/github/v/release/DarthBenro008/thread-broadcaster)\n[![GitHub License](https://img.shields.io/github/license/darthbenro008/thread-broadcaster)](https://github.com/DarthBenro008/thread-broadcaster/blob/master/LICENSE)\n[![Documentation](https://docs.rs/thread-broadcaster/badge.svg)](\nhttps://docs.rs/thread-broadcaster)\n\nThread Broadcaster is a Single Channel Multi-Producer (SPMC) library that enables the sending of notifications between threads. Unlike most Multi-Producer Multi-Consumer (MPMC) implementations, Thread Broadcaster ensures that all listeners receive the data, rather than just the first one.\n\n## 🤔 Features\n\n- Single Channel Multi-Producer (SPMC) architecture\n- Tad bit faster than MPMC (thanks to [crossbeam-channel](https://crates.io/crates/crossbeam-channel)!)\n- Senders and Receivers can be cloned and shared among threads.\n- Simple and intuitive API for sending and receiving notifications\n- Asynchronous notification broadcasting between threads\n- Support `tracing` for debugs\n\n## ⚡️ Quickstart\n\n```rust\nuse core::time;\nuse std::thread;\n\nuse thread_broadcaster::{BroadcastListener, Broadcaster};\n\nfn main() {\n    let (b, s) = Broadcaster::\u003cString\u003e::new();\n    let s2 = s.clone();\n    thread::spawn(move || {\n        let ls1 = BroadcastListener::register_broadcast_listener(s);\n        for msg in ls1.channel {\n            println!(\n                \"got broadcast with data: {} on thread {:#?}\",\n                msg,\n                thread::current().id()\n            );\n        }\n    });\n    thread::spawn(move || {\n        let ls2 = BroadcastListener::register_broadcast_listener(s2);\n        for msg in ls2.channel {\n            println!(\n                \"got broadcast with data: {} on thread {:#?}\",\n                msg,\n                thread::current().id()\n            );\n        }\n    });\n    thread::spawn(move || {\n        // we wait for registration\n        thread::sleep(time::Duration::from_secs(1));\n        b.broadcast(\"something to broadcast\".to_string());\n        // we wait for listeners to pickup before being dropped\n        thread::sleep(time::Duration::from_secs(2));\n    })\n    .join()\n    .unwrap();\n}\n```\n\n## ⬇️ Installation\n\n```\ncargo add thread-broadcaster\n```\n## 🤝 Contributions\n\n- Feel Free to Open a PR/Issue for any feature or bug(s).\n- Make sure you follow the [community guidelines](https://docs.github.com/en/github/site-policy/github-community-guidelines).\n- Feel free to open an issue to ask a question/discuss anything about melonpan.\n- Have a feature request? Open an Issue!\n\n\n## ⚖ License\n\nCopyright 2022 Hemanth Krishna\n\nLicensed under MIT License : https://opensource.org/licenses/MIT\n\n\u003cp align=\"center\"\u003eMade with ❤ and multiple cups of coffee \u003c/p\u003e\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdarthbenro008%2Fthread-broadcaster","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdarthbenro008%2Fthread-broadcaster","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdarthbenro008%2Fthread-broadcaster/lists"}