{"id":17336571,"url":"https://github.com/restioson/xtra","last_synced_at":"2025-05-14T20:09:45.082Z","repository":{"id":36956850,"uuid":"234699015","full_name":"Restioson/xtra","owner":"Restioson","description":"🎭 A tiny actor framework","archived":false,"fork":false,"pushed_at":"2024-11-16T12:06:10.000Z","size":573,"stargazers_count":336,"open_issues_count":17,"forks_count":39,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-05-07T12:49:14.136Z","etag":null,"topics":["actor-model","async","async-await","asynchronous","rust","safe","tiny"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Restioson.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":"2020-01-18T07:37:11.000Z","updated_at":"2025-04-23T20:30:45.000Z","dependencies_parsed_at":"2023-01-17T08:16:07.557Z","dependency_job_id":"a7a3cb68-72de-4265-b98b-e7d4aedd3752","html_url":"https://github.com/Restioson/xtra","commit_stats":{"total_commits":244,"total_committers":14,"mean_commits":"17.428571428571427","dds":0.3401639344262295,"last_synced_commit":"d98393a115ea52656585c43df327d3e392833810"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Restioson%2Fxtra","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Restioson%2Fxtra/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Restioson%2Fxtra/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Restioson%2Fxtra/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Restioson","download_url":"https://codeload.github.com/Restioson/xtra/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254219374,"owners_count":22034397,"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":["actor-model","async","async-await","asynchronous","rust","safe","tiny"],"created_at":"2024-10-15T15:31:29.353Z","updated_at":"2025-05-14T20:09:45.058Z","avatar_url":"https://github.com/Restioson.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Continuous integration](https://github.com/Restioson/xtra/actions/workflows/ci.yml/badge.svg)](https://github.com/Restioson/xtra/actions/workflows/ci.yml)\n![docs.rs](https://img.shields.io/docsrs/xtra)\n![Matrix](https://img.shields.io/matrix/xtra-community:matrix.org)\n\n# xtra\n\nA tiny, fast, and safe actor framework. It is modelled around Actix (copyright and license [here](https://github.com/Restioson/xtra/blob/master/LICENSE-ACTIX)).\n\n## Features\n\n- **Safe:** there is no unsafe code in xtra.\n- **Tiny:** xtra is only around 2000 LoC.\n- **Lightweight:** xtra has few dependencies, most of which are lightweight (except `futures`).\n- Asynchronous `Handler` interface which allows `async`/`await` syntax with `\u0026mut self`.\n- Does not depend on its own runtime and can be run with any futures executor. Convenience `spawn` functions are provided\n  for [Tokio](https://tokio.rs/), [async-std](https://async.rs/), [smol](https://github.com/stjepang/smol), and \n  [wasm-bindgen-futures](https://rustwasm.github.io/wasm-bindgen/api/wasm_bindgen_futures/).\n- Quite fast. Running on Tokio, \u003c170ns time from sending a message to it being processed for sending without waiting for a \nresult on my development machine with an AMD Ryzen 3 3200G.\n\n## Example\n\nThis is an example to use `xtra` with `tokio`. To compile this example it is needed to add the features `tokio` and `macros` in `Cargo.toml`.\n\n```toml\n[dependencies]\nxtra = { version = \"0.6.0\", features = [\"tokio\", \"macros\"] }\n```\n\n```rust\nuse xtra::prelude::*;\n\n#[derive(Default, xtra::Actor)]\nstruct Printer {\n    times: usize,\n}\n\nstruct Print(String);\n\nimpl Handler\u003cPrint\u003e for Printer {\n    type Return = ();\n\n    async fn handle(\u0026mut self, print: Print, _ctx: \u0026mut Context\u003cSelf\u003e) {\n        self.times += 1;\n        println!(\"Printing {}. Printed {} times so far.\", print.0, self.times);\n    }\n}\n\n#[tokio::main]\nasync fn main() {\n    let addr = xtra::spawn_tokio(Printer::default(), Mailbox::unbounded());\n    loop {\n        addr.send(Print(\"hello\".to_string()))\n            .await\n            .expect(\"Printer should not be dropped\");\n    }\n}\n\n```\n\nFor a longer example, check out [Vertex](https://github.com/Restioson/vertex/tree/development), a chat application written with xtra and spaad on the server.\n\n## Okay, sounds great! How do I use it?\n\nCheck out the [docs](https://docs.rs/xtra) and the [examples](https://github.com/Restioson/xtra/tree/master/xtra/examples) to get started!\nEnabling the `tokio`, `macros`, `async_std`, `smol`, or `wasm_bindgen` features is recommended in order to enable some  convenience methods (such as `xtra::spawn_tokio`).\nWhich you enable will depend on which executor you want to use (check out their docs to learn more about each).\nIf you have any questions, feel free to [open an issue](https://github.com/Restioson/xtra/issues/new) or message me on the [Rust discord](https://bit.ly/rust-community).\n\nKeep in mind that `xtra` has a MSRV of 1.60.0.\n\n## Cargo features\n\n- `async_std`: enables integration with [async-std](https://async.rs/).\n- `smol`: enables integration with [smol](https://github.com/smol-rs/smol).\n  Note that this requires smol 1.1 as 1.1 had a minor breaking change from 1.0 which leads to xtra no longer compiling on 1.0 and 1.1 simultaneously.\n- `tokio`: enables integration with [tokio](https://tokio.rs).\n- `wasm_bindgen`: enables integration with [wasm-bindgen](https://github.com/rustwasm/wasm-bindgen), and particularly its futures crate.\n- `instrumentation`: Adds a dependency on `tracing` and creates spans for message sending and handling on actors.\n- `sink`: Adds `Address::into_sink` and `MessageChannel::into_sink`.\n- `macros`: Enables the `Actor` custom derive macro.\n\n## Latest Breaking Changes\n\nTo see the breaking changes for each version, see [here](https://github.com/Restioson/xtra/blob/master/BREAKING-CHANGES.md).\nThe latest version is 0.6.0.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frestioson%2Fxtra","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frestioson%2Fxtra","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frestioson%2Fxtra/lists"}