typed_ecs
A no_std and no-alloc compatible tiny ECS written in Rust, which provides strong compile-time guarantees.
This project is in active development but technically is ready to be used, just note that its API will break often until v0.1.x releases.
About
typed_ecs is a tiny, zero-cost framework that:
- lets you wire plugins together at compile time, without runtime overhead
- is written for
no_stdandno_allocenvironments, but also for capable machines (profiling, async and parallel execution built-in) - contains no runtime (only a defined during compile-time execution logic): every plugin gets optimized by the compiler to the point that the produced assembly is comparable to a hand-written loop (see the godbolt section below)
- allows you to do async IO stuff without extra boilerplate
Key features
no_stdcompatible, andno-alloc: all kinds of platforms supported!- Compile-time plugin composition (in plugin collections)
- Strong compile-time guarantees
- Zero runtime-registration or reflection — everything resolved at compile time
- Light, optimized scheduler loop, with direct plugin calls (no indirection, no v-tables, and other overhead)
- Built-in parallelism: on platforms supporting it, all (!) non-applying systems are runned in parallel
- Async aboard! No need to do cursed stuff to handle IO: it's tightly integrated with typed_ecs!
- Ergonomic design: no tricky or cryptic code needed to use
typed_ecs: only one transparent macro - Community-ready: you can publish third-party plugins that other users could add in their applications in a plug & play manner (in the future, this process will be more documented)
Examples
Explore the examples to see typed_ecs in action:
Check the examples/ directory for more comprehensive examples, including:
hello_world.rs: Plugin definition and message on startupplugin_collection.rs: Explanation of how to build a plugin collectionprofile.rs: Usage of the crate's built-in profiling
Compile time optimizations demonstration
You may yourself test how typed_ecs examples produce neat, highly optimized
assembly, by going to this link (Godbolt).
Profiling with tracing
Example
There's an examples/profile.rs example for that! Check it out with:
# (forest tracing backend - zero setup needed compared to Tracy)
Why?
Tracing crate allows to easily profile Rust applications, a process that helps finding and resolving performance bottlenecks. Profilers play a critical role in optimizing software, and producing performant software.
Built-in tracing backends
typed_ecs offers two backends out of the box:
tracing-tracy(profile-tracyfeature) - Tracy is an advanced open-source profiling tool. It's available for Windows (GitHub releases) and Linux (build yourself or other distributors), and maybe other platforms. When the program exits, it waits until a Tracy instance captures the trace, and only then terminates.tracing-forest(profile-forestfeature) - A terminal trace producer. Works out of the box, with no external application required. It is the preferred option for quick setup & profiling. Lacks Tracy tooling.
Backends where some span data is lost and therefore unusable with typed_ecs (create an issue if you want to use some of them):
Benchmarks
typed_ecs implements criterion benchmarks. You can see them at benches
You can run these benchmarks with cargo bench. If you wish profiling the benches, you may
want to enable a profiler via a dedicated feature (profile-tracy for Tracy or profile-forest for a TUI profiler).
Contributing
We welcome contributions! Whether you're interested in:
- Reporting bugs
- Writing code
- Improving documentation
- Enhancing CI/CD pipelines
- Adding tests
- Creating a dedicated website
Please check our Contribution Guidelines first.
For larger contributions or significant changes (like creating a website), we recommend:
- Opening an issue using the Question template
- Discussing your approach with maintainers
- Getting alignment on design and implementation details
This ensures your efforts align with project goals and standards. For smaller fixes like documentation tweaks or test additions, feel free to submit a PR directly.
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.