Module prelude

Module prelude 

Source
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 BitSet trait members for your type through DerefMut.

Structs§

AtomicCell
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.
AtomicResource
A handle to a resource from a Resources collection.
BitFmt
BitSet formatter.
BitSetVec
The type of bitsets used to track entities in component storages. Mostly used to create caches.
CellAlreadyPresentError
Error thrown when a resource cell cannot be inserted because it already exists.
CommandQueue
A resource containing the Commands command queue.
Commands
A SystemParam that can be used to schedule systems that will be run at the end of the current SystemStage.
ComponentStore
A typed wrapper around UntypedComponentStore.
ComponentStores
A collection of ComponentStore<T>.
CurrentSystemStage
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.
EntitiesIterWith
Iterator over entities returned by Entities::iter_with.
Entity
An entity index.
EntityIterator
Iterator over entities using the provided bitset.
EnumRefAccess
Helper for accessing the inner data of a schema ref at runtime.
EnumRefMutAccess
Helper for accessing the inner data of a schema ref at runtime.
EnumSchemaInfo
Schema data for an enum.
FieldPath
A wrapper type that implements IntoIterator<Item = FieldIdx> for an inner string to make it easier to use with SchemaRefAccess::field_path() and other field path methods.
In
The system input parameter.
LabeledId
A Ulid with a human-readable ascii prefix.
OptionalQueryItem
Wrapper for the Comp SystemParam used as QueryItem to iterate over entities optionally retrieving components from ComponentStore. Entities iterated over will not be filtered by OptionalQueryItem.
OptionalQueryItemMut
Wrapper for the CompMut SystemParam used as QueryItem to iterate over entities optionally and mutably retrieving components from ComponentStore. Entities iterated over will not be filtered by OptionalQueryItemMut.
Ref
Wrapper for a borrowed AtomicCell that will released lock on drop.
RefMut
Wrapper for mutably borrowed AtomicCell that will released lock on drop.
Res
SystemParam for getting read access to a resource.
ResInit
SystemParam for getting read access to a resource and initialzing it if it doesn’t already exist.
ResMut
SystemParam for getting mutable access to a resource.
ResMutInit
SystemParam for 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.
SchemaBox
A owning, type-erased Box-like container for types with a [Schema].
SchemaData
Schema information describing the memory layout of a type.
SchemaDeserialize
Derivable schema type_data for types that implement Deserialize.
SchemaDeserializer
A struct that implements DeserializeSeed and can be used to deserialize values matching a given [Schema].
SchemaFieldNotFoundError
Error returned when a field is not found in a schema.
SchemaId
A unique identifier for a schema registered in the SCHEMA_REGISTRY.
SchemaLayoutInfo
Layout information computed for SchemaData.
SchemaMap
Untyped schema-aware “HashMap”.
SchemaMapAccess
Access helper for a SchemaMap.
SchemaMapMutAccess
Mutable SchemaMap access helper.
SchemaMismatchError
Error type when attempting to cast between types with mis-matched schemas.
SchemaRef
An untyped reference that knows the [Schema] of the pointee and that can be cast to a matching type.
SchemaRefMut
An untyped mutable reference that knows the [Schema] of the pointee and that can be cast to a matching type.
SchemaRegistry
A schema registry that alloates SchemaIds for SchemaDatas and returns a registered [&'static Schema][Schema].
SchemaSerializer
A struct that implements Serialize and wraps around a SchemaRef to serialize the value using it’s schema.
SchemaVec
A type-erased Vec-like collection that for items with the same [Schema].
SchemaVecAccess
Access helper for a SchemaVec.
SchemaVecMutAccess
Mutable SchemaVec access helper.
SessionStarted
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).
SimpleSystemStage
A collection of systems that will be run in order.
SingleSuccessSystems
Resource tracking which of single success systems in Session’s SystemStages have completed. Success is tracked to
StaticSystem
Struct containing a static system.
StructFieldInfo
A field in a StructSchemaInfo.
StructRefAccess
Helper for accessing the inner data of a schema ref at runtime.
StructRefFieldIter
Iterator for StructRefAccess::fields().
StructRefFieldIterField
A field returned by StructRefFieldIter.
StructRefMutAccess
Helper for accessing the inner data of a schema ref at runtime.
StructRefMutFieldIter
Iterator for StructRefAccess::fields().
StructRefMutFieldIterField
A field returned by StructRefFieldIter.
StructSchemaInfo
Schema data for a struct.
SystemStages
An ordered collection of SystemStages.
SystemStagesBuilder
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.
UntypedComponentBitsetIterator
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.
UntypedComponentBitsetIteratorMut
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.
UntypedComponentOptionalBitsetIterator
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.
UntypedComponentOptionalBitsetIteratorMut
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.
UntypedComponentStore
Holds components of a given type indexed by Entity.
UntypedComponentStoreIter
Mutable iterator over pointers in an untyped component store.
UntypedComponentStoreIterMut
Mutable iterator over pointers in an untyped component store.
UntypedResource
An untyped resource that may be inserted into UntypedResources.
UntypedResourceSet
Utility container for storing set of UntypedResource. Cloning
UntypedResources
Storage for un-typed resources.
Ustr
A handle representing a string in the global string cache.
VariantInfo
Information about an enum variant for EnumSchemaInfo.
World
The World is simply a collection of Resources, and ComponentStores.

Enums§

CoreStage
A StageLabel for the 5 core stages.
EnumTagType
A type for an enum tag for EnumSchemaInfo.
FieldIdx
The index of a field in a struct in a [Schema].
LabeledIdCreateError
Error creating a LabeledId.
LabledIdParseError
Errors that can happen while parsing a LabeledId.
Primitive
A type of primitive.
PrimitiveRef
Helper for accessing the inner data of a schema ref at runtime.
PrimitiveRefMut
Helper for accessing the inner data of a schema ref at runtime.
QuerySingleError
An error that may occur when querying for a single entity. For example, via Entities::get_single_with, or more directly with ComponentStore::get_single_with_bitset or ComponentStore::get_single_mut_with_bitset.
SchemaKind
A schema describes the data layout of a type, to enable dynamic access to the type’s data through a pointer.
SchemaRefAccess
Helper for accessing the inner data of a schema ref at runtime.
SchemaRefMutAccess
Access a schema

Constants§

BITSET_EXP
THREAD_RNG
A fast, non-cryptographic, thread-local random number generator powered by turborand.

Statics§

SCHEMA_REGISTRY
Global SchemaRegistry used to register SchemaDatas and produce [Schema]s.

Traits§

BitSet
The BitSet API.
ComponentIterBitset
This trait factors out functions for iterating with bitset over component store. Separated from impl ComponentStore for usage in generic trait types that must be able to create ComponentBitsetIterator and related types.
FromType
Trait implemented for types that can produce an instance of themselves from a Rust type.
FromWorld
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].
IntoSystem
Converts a function into a System.
QueryItem
A type representing a component-joining entity query.
StageLabel
Trait for things that may be used to identify a system stage.
System
Trait implemented by systems.
SystemParam
Trait used to implement parameters for System functions.
SystemStage
Trait for system stages. A stage is a
TurboRand
Extension trait for automatically implementing all TurboRand methods, as long as the struct implements [TurboCore] & GenCore. All methods are provided as default implementations that build on top of [TurboCore] and GenCore, and thus are not recommended to be overridden, lest you potentially change the expected outcome of the methods.
UlidExt
Extension trait for Ulid.
UnwrapMany
Helper trait for unwraping each item in an array.

Functions§

Optional
Helper func to construct a OptionalQueryItem wrapping a Comp SystemParam. Used to iterate over enities optionally retrieving components from ComponentStore. Entities iterated over will not be filtered by this QueryItem.
OptionalMut
Helper func to construct a OptionalQueryItemMut wrapping a CompMut SystemParam. Used to iterate over enities optionally and mutably retrieving components from ComponentStore. Entities iterated over will not be filtered by this QueryItem.
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§

AtomicComponentStore
An atomic component store.
AtomicUntypedResource
An untyped, atomic resource cell.
Comp
SystemParam for getting read access to a ComponentStore.
CompMut
SystemParam for getting mutable access to a ComponentStore.
ComponentBitsetIterator
Read-only iterator over components matching a given bitset
ComponentBitsetIteratorMut
Mutable iterator over components matching a given bitset
ComponentBitsetOptionalIterator
Read-only iterator over components matching a given bitset. Returns None for entities matching bitset but not in this ComponentStore.
ComponentBitsetOptionalIteratorMut
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
UntypedAtomicComponentStore
An untyped atomic component store.
UstrMap
A standard HashMap using Ustr as the key type with a custom Hasher that just uses the precomputed hash for speed instead of calculating it
UstrSet
A standard HashSet using Ustr as the key type with a custom Hasher that just uses the precomputed hash for speed instead of calculating it

Derive Macros§

Deref
Derive macro for deriving Deref on structs with one field.
DerefMut
Derive macro for deriving DerefMut on structs with one field.
HasSchema
Derive macro for the HasSchema trait.
SystemParam