Crate flecs_ecs

Crate flecs_ecs 

Source
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 Entity with various utility implementations.
newtype_of_entity_and_view
A macro to generate newtype wrappers for both Entity and EntityView with various utility implementations. It uses the macros newtype_of_entity and newtype_of_entity_view internally to generate the newtypes.
newtype_of_entity_view
A macro to generate a newtype wrapper for EntityView with various utility implementations.