百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
X

xtra

> 编程语言
开源

一个微小的演员框架

362 stars0 点赞2 次浏览
访问官网GitHub

工具介绍

一个微小的演员框架

xtra

A tiny, fast, and safe actor framework. It is modelled around Actix (copyright and license here).

Features

  • Safe: there is no unsafe code in xtra.
  • Tiny: xtra is only around 2000 LoC.
  • Lightweight: xtra has few dependencies, most of which are lightweight (except futures).
  • Asynchronous Handler interface which allows async/await syntax with &mut self.
  • Does not depend on its own runtime and can be run with any futures executor. Convenience spawn functions are provided for Tokio, async-std, smol, and wasm-bindgen-futures.
  • Quite fast. Running on Tokio, ) { self.times += 1; println!("Printing {}. Printed {} times so far.", print.0, self.times); } }

#[tokio::main] async fn main() { let addr = xtra::spawn_tokio(Printer::default(), Mailbox::unbounded()); loop { addr.send(Print("hello".to_string())) .await .expect("Printer should not be dropped"); } }


For a longer example, check out [Vertex](https://github.com/Restioson/vertex/tree/development), a chat application written with xtra and spaad on the server.

## Okay, sounds great! How do I use it?

Check out the [docs](https://docs.rs/xtra) and the [examples](https://github.com/Restioson/xtra/tree/master/xtra/examples) to get started!
Enabling the `tokio`, `macros`, `async_std`, `smol`, or `wasm_bindgen` features is recommended in order to enable some  convenience methods (such as `xtra::spawn_tokio`).
Which you enable will depend on which executor you want to use (check out their docs to learn more about each).
If 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).

Keep in mind that `xtra` has a MSRV of 1.60.0.

## Cargo features

- `async_std`: enables integration with [async-std](https://async.rs/).
- `smol`: enables integration with [smol](https://github.com/smol-rs/smol).
  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.
- `tokio`: enables integration with [tokio](https://tokio.rs).
- `wasm_bindgen`: enables integration with [wasm-bindgen](https://github.com/rustwasm/wasm-bindgen), and particularly its futures crate.
- `instrumentation`: Adds a dependency on `tracing` and creates spans for message sending and handling on actors.
- `sink`: Adds `Address::into_sink` and `MessageChannel::into_sink`.
- `macros`: Enables the `Actor` custom derive macro.

## Latest Breaking Changes

To see the breaking changes for each version, see [here](https://github.com/Restioson/xtra/blob/master/BREAKING-CHANGES.md).
The latest version is 0.6.0.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Rustactor-modelasyncasync-awaitasynchronous

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言