{"id":17128037,"url":"https://github.com/novacrazy/parallel-event-emitter","last_synced_at":"2025-04-13T06:32:05.761Z","repository":{"id":57652785,"uuid":"79319649","full_name":"novacrazy/parallel-event-emitter","owner":"novacrazy","description":"Parallel event emitter built on futures-rs","archived":false,"fork":false,"pushed_at":"2017-01-20T23:46:08.000Z","size":35,"stargazers_count":29,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-26T23:11:19.963Z","etag":null,"topics":["event-emitter","futures","parallel","rust"],"latest_commit_sha":null,"homepage":"https://docs.rs/parallel-event-emitter","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/novacrazy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-01-18T08:32:16.000Z","updated_at":"2023-02-08T00:30:05.000Z","dependencies_parsed_at":"2022-08-25T13:23:59.326Z","dependency_job_id":null,"html_url":"https://github.com/novacrazy/parallel-event-emitter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/novacrazy%2Fparallel-event-emitter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/novacrazy%2Fparallel-event-emitter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/novacrazy%2Fparallel-event-emitter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/novacrazy%2Fparallel-event-emitter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/novacrazy","download_url":"https://codeload.github.com/novacrazy/parallel-event-emitter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248674659,"owners_count":21143760,"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":["event-emitter","futures","parallel","rust"],"created_at":"2024-10-14T19:06:05.885Z","updated_at":"2025-04-13T06:32:05.485Z","avatar_url":"https://github.com/novacrazy.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"Parallel Event Emitter\n======================\n\nImplementation of an event emitter that invokes event listener callbacks concurrently in a configurable thread pool,\nusing `Future`s to notify callers of success or errors.\n\nBecause all values must be transferred across thread boundaries, all types `T` must be `Send`.\n\nAdditionally, all types `T` must be `Any`, so `T: 'static`.\n\n## Usage\n\n```toml\n[dependencies]\nfutures = \"0.1\"\nparallel-event-emitter = \"0.2.4\"\n```\n\nExample using a `String` as the key:\n\n```rust\nextern crate futures;\nextern crate parallel_event_emitter;\n\nuse futures::Future;\nuse parallel_event_emitter::*;\n\nfn main() {\n    let mut emitter: ParallelEventEmitter\u003cString\u003e = ParallelEventEmitter::new();\n\n    emitter.add_listener(\"some event\", || {\n        println!(\"Hello, World!\");\n\n        Ok(())\n    }).unwrap();\n\n    assert_eq!(1, emitter.emit(\"some event\").wait().unwrap());\n}\n```\n\nOr using a custom event type:\n\n```rust\nextern crate futures;\nextern crate parallel_event_emitter;\n\nuse futures::Future;\nuse parallel_event_emitter::*;\n\n#[derive(Debug, Hash, PartialEq, Eq, Clone)]\nenum MyEvents {\n    EventA,\n    EventB,\n}\n\nfn main() {\n    let mut emitter: ParallelEventEmitter\u003cMyEvents\u003e = ParallelEventEmitter::new();\n\n    emitter.add_listener(MyEvents::EventA, || {\n        println!(\"Hello, World!\");\n\n        Ok(())\n    }).unwrap();\n\n    assert_eq!(1, emitter.emit(MyEvents::EventA).wait().unwrap());\n}\n```\n\n## `Trace\u003cE\u003e` type\n\nThis crate depends on the [`trace-error`](https://crates.io/crates/trace-error) crate to have simple and lightweight backtraces on all error `Result`s.\n\nIf you choose not to use that, which is fine by me, simply call `.into_error()` on all `Trace\u003cE\u003e` values to get the real error.\n\n## `impl Trait` feature\n\nInstead of having all the `emit*` methods returning a boxed `Future` (`BoxFuture`),\nthe Cargo feature **`conservative_impl_trait`** can be given to enable `impl Future` return types on\nall the `emit*` methods.\n\n```toml\n[dependencies.parallel-event-emitter]\nversion = \"0.2.4\"\nfeatures = [\"default\", \"conservative_impl_trait\"] # And maybe integer_atomics\n```\n\n## Larger `ListenerId`s\n\nAlthough the `ListenerId` type itself is `u64`,\nthe atomic counter underneath is restricted to `AtomicUsize` by default.\n\nTo enable true guaranteed 64-bit counters, use the `integer_atomics` feature for the crate.\n\n```toml\n[dependencies.parallel-event-emitter]\nversion = \"0.2.4\"\nfeatures = [\"default\", \"integer_atomics\"] # And maybe conservative_impl_trait\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnovacrazy%2Fparallel-event-emitter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnovacrazy%2Fparallel-event-emitter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnovacrazy%2Fparallel-event-emitter/lists"}