{"id":22543069,"url":"https://github.com/fdeantoni/tiny-tokio-actor","last_synced_at":"2026-04-06T04:31:28.278Z","repository":{"id":45496318,"uuid":"362460442","full_name":"fdeantoni/tiny-tokio-actor","owner":"fdeantoni","description":"A simple tiny actor library on top of Tokio","archived":false,"fork":false,"pushed_at":"2026-01-22T08:26:01.000Z","size":114,"stargazers_count":75,"open_issues_count":6,"forks_count":9,"subscribers_count":4,"default_branch":"main","last_synced_at":"2026-03-16T05:38:01.223Z","etag":null,"topics":["actors","rust","tokio"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fdeantoni.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":"2021-04-28T12:32:13.000Z","updated_at":"2026-02-06T23:27:54.000Z","dependencies_parsed_at":"2025-01-09T20:40:30.505Z","dependency_job_id":null,"html_url":"https://github.com/fdeantoni/tiny-tokio-actor","commit_stats":{"total_commits":56,"total_committers":2,"mean_commits":28.0,"dds":0.0714285714285714,"last_synced_commit":"bb2d74c2932c3c7ffb2bc2cef8e04661a47af313"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/fdeantoni/tiny-tokio-actor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fdeantoni%2Ftiny-tokio-actor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fdeantoni%2Ftiny-tokio-actor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fdeantoni%2Ftiny-tokio-actor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fdeantoni%2Ftiny-tokio-actor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fdeantoni","download_url":"https://codeload.github.com/fdeantoni/tiny-tokio-actor/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fdeantoni%2Ftiny-tokio-actor/sbom","scorecard":{"id":394762,"data":{"date":"2025-08-11","repo":{"name":"github.com/fdeantoni/tiny-tokio-actor","commit":"9b624ad6aec910b3839332cfcf3f550b3e1a1897"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.7,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/rust.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Code-Review","score":0,"reason":"Found 2/26 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/rust.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/fdeantoni/tiny-tokio-actor/rust.yml/main?enable=pin","Info:   0 out of   1 GitHub-owned GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":-1,"reason":"internal error: internal error: Client.Checks.ListCheckRunsForRef: error during graphqlHandler.setupCheckRuns: non-200 OK status code: 502 Bad Gateway body: \"\u003chtml\u003e\\r\\n\u003chead\u003e\u003ctitle\u003e502 Bad Gateway\u003c/title\u003e\u003c/head\u003e\\r\\n\u003cbody\u003e\\r\\n\u003ccenter\u003e\u003ch1\u003e502 Bad Gateway\u003c/h1\u003e\u003c/center\u003e\\r\\n\u003chr\u003e\u003ccenter\u003enginx\u003c/center\u003e\\r\\n\u003c/body\u003e\\r\\n\u003c/html\u003e\\r\\n\"","details":null,"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-18T18:42:53.846Z","repository_id":45496318,"created_at":"2025-08-18T18:42:53.846Z","updated_at":"2025-08-18T18:42:53.846Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31460008,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-05T21:22:52.476Z","status":"online","status_checked_at":"2026-04-06T02:00:07.287Z","response_time":112,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["actors","rust","tokio"],"created_at":"2024-12-07T13:13:58.054Z","updated_at":"2026-04-06T04:31:28.260Z","avatar_url":"https://github.com/fdeantoni.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# *Tiny Tokio Actor* #\n\n[![crates.io](https://img.shields.io/crates/v/tiny-tokio-actor)](https://crates.io/crates/tiny-tokio-actor) [![build](https://github.com/fdeantoni/tiny-tokio-actor/actions/workflows/rust.yml/badge.svg)](https://github.com/fdeantoni/tiny-tokio-actor/actions/workflows/rust.yml)\n\nAnother actor library! Why another? I really like the actor model for development, and wanted something simple I could use on top of [tokio](https://github.com/tokio-rs/tokio).\n\n```toml\n[dependencies]\ntiny-tokio-actor = \"0.3\"\n```\n\nLets define an actor. First import the necessary crate:\n\n```rust\nuse tiny_tokio_actor::*;\n```\n\nNext define the message we will be sending on the actor system's message bus:\n\n```rust\n// Define the system event bus message\n#[derive(Clone, Debug)]\nstruct TestEvent(String);\n\nimpl SystemEvent for TestEvent {}\n```\n\nNext define the actor struct. The actor struct must be Send + Sync but need not\nbe Clone. When implementing the `Actor` trait, you can opt to override the default\n`timeout()`, `supervision_strategy()`, `pre_start()`, `pre_restart()`, and\n`post_stop()` methods:\n\n```rust\nstruct TestActor {\n    counter: usize\n}\n\n#[async_trait]\nimpl Actor\u003cTestEvent\u003e for TestActor {\n\n    // This actor will time out after 5 seconds of not receiving a message\n    fn timeout() -\u003e Option\u003cDuration\u003e {\n        Some(Duration::from_secs(5))\n    }\n\n    // This actor will immediately retry 5 times if it fails to start\n    fn supervision_strategy() -\u003e SupervisionStrategy {\n        let strategy = supervision::NoIntervalStrategy::new(5);\n        SupervisionStrategy::Retry(Box::new(strategy))\n    }\n\n    async fn pre_start(\u0026mut self, ctx: \u0026mut ActorContext\u003cTestEvent\u003e) -\u003e Result\u003c(), ActorError\u003e {\n        ctx.system.publish(TestEvent(format!(\"Actor '{}' started.\", ctx.path)));\n        Ok(())\n    }\n\n    async fn pre_restart(\u0026mut self, ctx: \u0026mut ActorContext\u003cTestEvent\u003e, error: Option\u003c\u0026ActorError\u003e) -\u003e Result\u003c(), ActorError\u003e {\n        log::error!(\"Actor '{}' is restarting due to {:#?}\", ctx.path, error);\n        self.pre_start(ctx).await\n    }\n\n    async fn post_stop(\u0026mut self, ctx: \u0026mut ActorContext\u003cTestEvent\u003e) {\n        ctx.system.publish(TestEvent(format!(\"Actor '{}' stopped.\", ctx.path)));\n    }\n}\n```\n\nNext define a message you want the actor to handle. Note that you also define the\nresponse you expect back from the actor. If you do not want a response back you can\nsimply use `()` as response type.\n\n```rust\n#[derive(Clone, Debug)]\nstruct TestMessage(String);\n\nimpl Message for TestMessage {\n    type Response = String;\n}\n```\n\nNow implement the behaviour we want from the actor when we receive the message:\n\n```rust\n#[async_trait]\nimpl Handler\u003cTestEvent, TestMessage\u003e for TestActor {\n    async fn handle(\u0026mut self, msg: TestMessage, ctx: \u0026mut ActorContext\u003cTestEvent\u003e) -\u003e String {\n        ctx.system.publish(TestEvent(format!(\"Message {} received by '{}'\", \u0026msg, ctx.path)));\n        self.counter += 1;\n        \"Ping!\".to_string()\n    }\n}\n```\n\nYou can define more messages and behaviours you want the actor to handle. For example, lets\ndefine an `OtherMessage` we will let our actor handle:\n\n```rust\n#[derive(Clone, Debug)]\nstruct OtherMessage(usize);\n\nimpl Message for OtherMessage {\n    type Response = usize;\n}\n\n// What the actor should do with the other message\n#[async_trait]\nimpl Handler\u003cTestEvent, OtherMessage\u003e for TestActor {\n    async fn handle(\u0026mut self, msg: OtherMessage, ctx: \u0026mut ActorContext\u003cTestEvent\u003e) -\u003e usize {\n        ctx.system.publish(TestEvent(format!(\"Message {} received by '{}'\", \u0026msg, ctx.path)));\n        self.counter += msg.0;\n        self.counter\n    }\n}\n```\n\nWe can now test out our actor and send the two message types to it:\n\n```rust\n#[tokio::test]\nasync fn multi_message() {\n    if std::env::var(\"RUST_LOG\").is_err() {\n        std::env::set_var(\"RUST_LOG\", \"trace\");\n    }\n    let _ = env_logger::builder().is_test(true).try_init();\n\n    let actor = TestActor { counter: 0 };\n\n    let bus = EventBus::\u003cTestEvent\u003e::new(1000);\n    let system = ActorSystem::new(\"test\", bus);\n    let actor_ref = system.create_actor(\"test-actor\", actor).await.unwrap();\n\n    let mut events = system.events();\n    tokio::spawn(async move {\n        loop {\n            match events.recv().await {\n                Ok(event) =\u003e println!(\"Received event! {:?}\", event),\n                Err(err) =\u003e println!(\"Error receivng event!!! {:?}\", err)\n            }\n        }\n    });\n\n    tokio::time::sleep(tokio::time::Duration::from_millis(10)).await;\n\n    let msg_a = TestMessage(\"hello world!\".to_string());\n    let response_a = actor_ref.ask(msg_a).await.unwrap();\n    assert_eq!(response_a, \"Ping!\".to_string());\n\n    let msg_b = OtherMessage(10);\n    let response_b = actor_ref.ask(msg_b).await.unwrap();\n    assert_eq!(response_b, 11);\n}\n```\n\nSo basically this library provides:\n\n* An actor system with a message bus\n* A strongly typed actor with one or more message handlers\n* Actors referenced through ActorPaths and ActorRefs\n* A supervision stragegy per actor type\n* A timeout per actor type\n\nSee the [docs](https://docs.rs/tiny-tokio-actor), [examples](https://github.com/fdeantoni/tiny-tokio-actor/tree/main/examples), and [integration tests](https://github.com/fdeantoni/tiny-tokio-actor/tree/main/tests) for more detailed examples.\n\nLibrary is still incubating! There is still a lot to be done and the API is still unstable! The\ntodo list so far:\n\n* Supervisor hierarchy\n* Create macros to make the defining of actors a lot simpler\n\nProjects / blog posts that are worth checking out:\n\n* [Coerce-rs](https://github.com/LeonHartley/Coerce-rs)\n* [Actors with Tokio](https://ryhl.io/blog/actors-with-tokio/)\n* [Unbounded channel deadlock risk](https://www.reddit.com/r/rust/comments/ljx7mc/actors_with_tokio)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffdeantoni%2Ftiny-tokio-actor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffdeantoni%2Ftiny-tokio-actor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffdeantoni%2Ftiny-tokio-actor/lists"}