| Crates.io | kon_ecs |
| lib.rs | kon_ecs |
| version | 0.2.0 |
| created_at | 2026-01-09 19:51:23.922173+00 |
| updated_at | 2026-01-17 12:06:08.947613+00 |
| description | High-performance SparseSet-based ECS for the Kon Engine. |
| homepage | https://github.com/cey0225/kon |
| repository | https://github.com/cey0225/kon |
| max_upload_size | |
| id | 2032743 |
| size | 78,960 |
kon_ecs is the ECS implementation for Kon Engine, built around SparseSet storage for fast iteration.
# Use it as part of the engine
cargo add kon-engine
# Or use the ECS core directly
cargo add kon_ecs
You can use the ECS core independently from the engine.
use kon_ecs::World;
// Define your components
#[derive(Debug, Clone, PartialEq)]
struct Position { x: f32, y: f32 }
#[derive(Debug, Clone, PartialEq)]
struct Velocity { x: f32, y: f32 }
fn main() {
let mut world = World::new();
// Spawn entities with components
world.spawn()
.insert(Position { x: 0.0, y: 0.0 })
.insert(Velocity { x: 1.0, y: 1.0 })
.id();
// Query and iterate
world.select_mut::<(Position, Velocity)>().each(|_, (pos, vel)| {
pos.x += vel.x;
pos.y += vel.y;
});
}
You can define components in two ways:
kon_macros crate for a cleaner syntax.#[component] // Optional with kon_macros
struct Position { x: f32, y: f32 }
MIT OR Apache-2.0