Expand description
Flecs is a fast and lightweight Entity Component System that lets you build games and simulations with millions of entities.
This library provides a comprehensive and low-overhead Rust binding for Flecs an ECS written in C.
§Documentation
- The flecs.dev website contains comprehensive documentation on Flecs on its features & how to use it for Rust and other languages.
- Component Macro - Complete guide to the
#[derive(Component)]macro and all its attributes. - DSL Macro - Query, system, and observer DSL documentation
§Safety
This crate enables additional runtime checks by default to preserve Rust’s
borrowing and concurrency guarantees when calling into the underlying C
Flecs library. Those checks are provided by the flecs_safety_locks feature
(enabled by default) and help prevent unsafe aliasing and concurrent mutable
access across Flecs callbacks, systems and queries.
These safety checks imposes a runtime cost. If you fully understand the
characteristics of your application and need maximum performance,
you may disable flecs_safety_locks (e.g. for a Release). Disabling it will
improve throughput but removes the runtime protections and may lead to
undefined behavior if the API is used in an unsafe way. This might or might not matter
depending on the application.
Re-exports§
pub use flecs_ecs_derive as macros;pub use flecs_ecs_sys as sys;
Modules§
- addons
- Flecs addons extend the core ECS with additional functionality.
- component_
macro - Component derive macro documentation and usage guide.
- core
- dsl
- Flecs Rust DSL documentation and examples.
- prelude
Macros§
- assert_
is_ type - Assert that a struct field has a given type.
- component
- Function-like macro for registering a component, optionally including field metadata.
- component_
ext - Function-like macro for registering an external component, optionally including field metadata.
- component_
type_ stringify - Like
stringify!but omits whitespace around generics. - id
- impl_
component_ traits_ primitive_ type - member
- Function-like macro for registering a component’s field metadata.
- member_
ext - Function-like macro for registering an external component’s field metadata.
- meta_
register_ vector_ func - Creates a function to manage a vector component type with metadata.
- meta_
register_ vector_ type - Registers a vector component type with metadata.
- newtype_
of_ entity - A macro to generate a newtype wrapper for
Entitywith various utility implementations. - newtype_
of_ entity_ and_ view - A macro to generate newtype wrappers for both
EntityandEntityViewwith various utility implementations. It uses the macrosnewtype_of_entityandnewtype_of_entity_viewinternally to generate the newtypes. - newtype_
of_ entity_ view - A macro to generate a newtype wrapper for
EntityViewwith various utility implementations.