Expand description
Bones lib prelude
Re-exports§
pub use crate::Game;pub use crate::GamePlugin;pub use crate::Session;pub use crate::SessionBuilder;pub use crate::SessionCommand;pub use crate::SessionOptions;pub use crate::SessionPlugin;pub use crate::SessionRunner;pub use crate::Sessions;pub use crate::reset::*;pub use crate::time::*;
Modules§
- bones_
schema - Simple reflection system based on the
#[repr(C)]memory layout. - borrow
- This module contains types that can be used to implement atomic borrowing.
Macros§
- bitor
- Shorthand for combining bitsets with bit_or.
- bitset
- Shorthand for setting bits on the bitset container.
- impl_
bitset - Implements the
BitSettrait members for your type throughDerefMut.
Structs§
- Atomic
Cell - A mutable memory location with dynamically checked borrow rules
This type behaves mostly like
core::cell::RefCell. The main difference is that this type uses atomic operations for borrowing. Thus allowing to use it in multi-threaded environment. - Atomic
Resource - A handle to a resource from a
Resourcescollection. - BitFmt
- BitSet formatter.
- BitSet
Vec - The type of bitsets used to track entities in component storages. Mostly used to create caches.
- Cell
Already Present Error - Error thrown when a resource cell cannot be inserted because it already exists.
- Command
Queue - A resource containing the
Commandscommand queue. - Commands
- A
SystemParamthat can be used to schedule systems that will be run at the end of the currentSystemStage. - Component
Store - A typed wrapper around
UntypedComponentStore. - Component
Stores - A collection of
ComponentStore<T>. - Current
System Stage - Resource that is automatically added to the world while a system stage is being run that specifies the unique ID of the stage that being run.
- Entities
- Holds a list of alive entities.
- Entities
Iter With - Iterator over entities returned by
Entities::iter_with. - Entity
- An entity index.
- Entity
Iterator - Iterator over entities using the provided bitset.
- Enum
RefAccess - Helper for accessing the inner data of a schema ref at runtime.
- Enum
RefMut Access - Helper for accessing the inner data of a schema ref at runtime.
- Enum
Schema Info - Schema data for an enum.
- Field
Path - A wrapper type that implements
IntoIterator<Item = FieldIdx>for an inner string to make it easier to use withSchemaRefAccess::field_path()and other field path methods. - In
- The system input parameter.
- Labeled
Id - A
Ulidwith a human-readable ascii prefix. - Optional
Query Item - Wrapper for the
CompSystemParamused asQueryItemto iterate over entities optionally retrieving components fromComponentStore. Entities iterated over will not be filtered byOptionalQueryItem. - Optional
Query Item Mut - Wrapper for the
CompMutSystemParamused asQueryItemto iterate over entities optionally and mutably retrieving components fromComponentStore. Entities iterated over will not be filtered byOptionalQueryItemMut. - Ref
- Wrapper for a borrowed
AtomicCellthat will released lock on drop. - RefMut
- Wrapper for mutably borrowed
AtomicCellthat will released lock on drop. - Res
SystemParamfor getting read access to a resource.- ResInit
SystemParamfor getting read access to a resource and initialzing it if it doesn’t already exist.- ResMut
SystemParamfor getting mutable access to a resource.- ResMut
Init SystemParamfor getting mutable access to a resource and initializing it if it doesn’t already exist.- Resources
- A collection of resources.
- SBox
- A typed version of
SchemaBox. - SMap
- Typed version of a
SchemaMap. - SVec
- A typed version of a
SchemaVec. - Schema
Box - A owning, type-erased
Box-like container for types with a [Schema]. - Schema
Data - Schema information describing the memory layout of a type.
- Schema
Deserialize - Derivable schema
type_datafor types that implementDeserialize. - Schema
Deserializer - A struct that implements
DeserializeSeedand can be used to deserialize values matching a given [Schema]. - Schema
Field NotFound Error - Error returned when a field is not found in a schema.
- Schema
Id - A unique identifier for a schema registered in the
SCHEMA_REGISTRY. - Schema
Layout Info - Layout information computed for
SchemaData. - Schema
Map - Untyped schema-aware “HashMap”.
- Schema
MapAccess - Access helper for a
SchemaMap. - Schema
MapMut Access - Mutable
SchemaMapaccess helper. - Schema
Mismatch Error - Error type when attempting to cast between types with mis-matched schemas.
- Schema
Ref - An untyped reference that knows the [
Schema] of the pointee and that can be cast to a matching type. - Schema
RefMut - An untyped mutable reference that knows the [
Schema] of the pointee and that can be cast to a matching type. - Schema
Registry - A schema registry that alloates
SchemaIds forSchemaDatas and returns a registered [&'static Schema][Schema]. - Schema
Serializer - A struct that implements
Serializeand wraps around aSchemaRefto serialize the value using it’s schema. - Schema
Vec - A type-erased
Vec-like collection that for items with the same [Schema]. - Schema
VecAccess - Access helper for a
SchemaVec. - Schema
VecMut Access - Mutable
SchemaVecaccess helper. - Session
Started - Resource tracking if Session has started (startup systems executed and resources inserted). If field is set to false, that operation needs to be handled on next stage run. If resource is not present, assumed to have not started (and will be initialized upon next stage execution).
- Simple
System Stage - A collection of systems that will be run in order.
- Single
Success Systems - Resource tracking which of single success systems in
Session’sSystemStageshave completed. Success is tracked to - Static
System - Struct containing a static system.
- Struct
Field Info - A field in a
StructSchemaInfo. - Struct
RefAccess - Helper for accessing the inner data of a schema ref at runtime.
- Struct
RefField Iter - Iterator for
StructRefAccess::fields(). - Struct
RefField Iter Field - A field returned by
StructRefFieldIter. - Struct
RefMut Access - Helper for accessing the inner data of a schema ref at runtime.
- Struct
RefMut Field Iter - Iterator for
StructRefAccess::fields(). - Struct
RefMut Field Iter Field - A field returned by
StructRefFieldIter. - Struct
Schema Info - Schema data for a struct.
- System
Stages - An ordered collection of
SystemStages. - System
Stages Builder - Builder for
SystemStages. It is immutable once created, - Ulid
- A Ulid is a unique 128-bit lexicographically sortable identifier
- Unsafe
- A wrapper struct that marks it unsafe to both create and access the inner value.
- Untyped
Component Bitset Iterator - Iterates over components using a provided bitset. Each time the bitset has a 1 in index i, the iterator will fetch data from the storage at index i and return it.
- Untyped
Component Bitset Iterator Mut - Iterates over components using a provided bitset. Each time the bitset has a 1 in index i, the iterator will fetch data from the storage at index i.
- Untyped
Component Optional Bitset Iterator - Iterate over component store returning
Option<SchemaRef<'a>>, filtered by bitset of iterator, but not bitset of own ComponentStore. Returns None on bitset entries that do not have this Component. - Untyped
Component Optional Bitset Iterator Mut - Iterate mutably over component store returning
Option<SchemaRef<'a>>, filtered by bitset of iterator, but not bitset of own ComponentStore. Returns None on bitset entries that do not have this Component. - Untyped
Component Store - Holds components of a given type indexed by
Entity. - Untyped
Component Store Iter - Mutable iterator over pointers in an untyped component store.
- Untyped
Component Store Iter Mut - Mutable iterator over pointers in an untyped component store.
- Untyped
Resource - An untyped resource that may be inserted into
UntypedResources. - Untyped
Resource Set - Utility container for storing set of
UntypedResource. Cloning - Untyped
Resources - Storage for un-typed resources.
- Ustr
- A handle representing a string in the global string cache.
- Variant
Info - Information about an enum variant for
EnumSchemaInfo. - World
- The
Worldis simply a collection ofResources, andComponentStores.
Enums§
- Core
Stage - A
StageLabelfor the 5 core stages. - Enum
TagType - A type for an enum tag for
EnumSchemaInfo. - Field
Idx - The index of a field in a struct in a [
Schema]. - Labeled
IdCreate Error - Error creating a
LabeledId. - Labled
IdParse Error - Errors that can happen while parsing a
LabeledId. - Primitive
- A type of primitive.
- Primitive
Ref - Helper for accessing the inner data of a schema ref at runtime.
- Primitive
RefMut - Helper for accessing the inner data of a schema ref at runtime.
- Query
Single Error - An error that may occur when querying for a single entity. For example, via
Entities::get_single_with, or more directly withComponentStore::get_single_with_bitsetorComponentStore::get_single_mut_with_bitset. - Schema
Kind - A schema describes the data layout of a type, to enable dynamic access to the type’s data through a pointer.
- Schema
RefAccess - Helper for accessing the inner data of a schema ref at runtime.
- Schema
RefMut Access - Access a schema
Constants§
- BITSET_
EXP - THREAD_
RNG - A fast, non-cryptographic, thread-local random number generator powered by turborand.
Statics§
- SCHEMA_
REGISTRY - Global
SchemaRegistryused to registerSchemaDatas and produce [Schema]s.
Traits§
- BitSet
- The BitSet API.
- Component
Iter Bitset - This trait factors out functions for iterating with bitset over component store.
Separated from
impl ComponentStorefor usage in generic trait types that must be able to createComponentBitsetIteratorand related types. - From
Type - Trait implemented for types that can produce an instance of themselves from a Rust type.
- From
World - Creates an instance of the type this trait is implemented for
using data from the supplied
World. - GenCore
- This trait provides the means to easily generate all integer types, provided
the main method underpinning this is implemented:
GenCore::gen. Once implemented, the rest of the trait provides default implementations for generating all integer types, though it is not recommended to override these. - HasSchema
- Trait implemented for types that have a [
Schema]. - Into
System - Converts a function into a
System. - Query
Item - A type representing a component-joining entity query.
- Stage
Label - Trait for things that may be used to identify a system stage.
- System
- Trait implemented by systems.
- System
Param - Trait used to implement parameters for
Systemfunctions. - System
Stage - Trait for system stages. A stage is a
- Turbo
Rand - Extension trait for automatically implementing all
TurboRandmethods, as long as the struct implements [TurboCore] &GenCore. All methods are provided as default implementations that build on top of [TurboCore] andGenCore, and thus are not recommended to be overridden, lest you potentially change the expected outcome of the methods. - UlidExt
- Extension trait for
Ulid. - Unwrap
Many - Helper trait for unwraping each item in an array.
Functions§
- Optional
- Helper func to construct a
OptionalQueryItemwrapping aCompSystemParam. Used to iterate over enities optionally retrieving components fromComponentStore. Entities iterated over will not be filtered by thisQueryItem. - Optional
Mut - Helper func to construct a
OptionalQueryItemMutwrapping aCompMutSystemParam. Used to iterate over enities optionally and mutably retrieving components fromComponentStore. Entities iterated over will not be filtered by thisQueryItem. - create_
bitset - Creates a bitset big enough to contain the index of each entity. Mostly used to create caches.
- default
- An ergonomic abbreviation for
Default::default()to make initializing structs easier. This is especially helpful when combined with “struct update syntax”. - get_
short_ name - Shortens a type name to remove all module paths.
- likely
- Hints to the compiler that the branch condition is likely to be true. Returns the value passed to it.
- unlikely
- Hints to the compiler that the branch condition is unlikely to be true. Returns the value passed to it.
- ustr
- Create a new Ustr from the given &str.
Type Aliases§
- Atomic
Component Store - An atomic component store.
- Atomic
Untyped Resource - An untyped, atomic resource cell.
- Comp
SystemParamfor getting read access to aComponentStore.- CompMut
SystemParamfor getting mutable access to aComponentStore.- Component
Bitset Iterator - Read-only iterator over components matching a given bitset
- Component
Bitset Iterator Mut - Mutable iterator over components matching a given bitset
- Component
Bitset Optional Iterator - Read-only iterator over components matching a given bitset. Returns None for entities matching bitset but not in this ComponentStore.
- Component
Bitset Optional Iterator Mut - Mutable iterator over components matching a given bitset. Returns None for entities matching bitset but not in this ComponentStore.
- HashMap
- A [
HashMap][hashbrown::HashMap] implementing aHash, a high speed keyed hashing algorithm intended for use in in-memory hashmaps. - HashSet
- A [
HashSet][hashbrown::HashSet] implementing aHash, a high speed keyed hashing algorithm intended for use in in-memory hashmaps. - Instant
- Untyped
Atomic Component Store - An untyped atomic component store.
- UstrMap
- A standard
HashMapusingUstras the key type with a customHasherthat just uses the precomputed hash for speed instead of calculating it - UstrSet
- A standard
HashSetusingUstras the key type with a customHasherthat just uses the precomputed hash for speed instead of calculating it