Module prelude

Source
Expand description

The prelude.

Modules§

bones_schema
Simple reflection system based on the #[repr(C)] memory layout.

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.
smallvec
Creates a SmallVec containing the arguments.

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.
Drain
An iterator that removes the items from a SmallVec and yields them by value.
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.
IntoIter
An iterator that consumes a SmallVec and yields its items by value.
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.
SimpleSystemStage
A collection of systems that will be run in order.
SmallVec
A Vec-like container that can store a small number of elements inline.
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.
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.
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§

CollectionAllocErr
Error type for APIs with fallible heap allocation
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.
MaybeOwned
This type provides a way to store data to which you either have a reference to or which you do own.
MaybeOwnedMut
This type is basically the same as MaybeOwned, but works with mutable references.
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
TurboKind
Enum for determining the kind of PRNG, whether a fast one, or a slow, possibly crypographically secure one.

Constants§

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§

Array
Types that can be used as the backing store for a SmallVec.
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.
ForkableCore
Trait for enabling creating new TurboCore instances from an original instance. Similar to cloning, except forking modifies the state of the original instance in order to provide a new, random state for the forked instance. This allows for creating many randomised instances from a single seed in a deterministic manner.
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.
SecureCore
A marker trait to be applied to anything that implements TurboCore in order to indicate that a PRNG source is cryptographically secure, so being a CSPRNG.
SeededCore
Trait for implementing Seedable PRNGs, requiring that the PRNG implements TurboCore as a baseline. Seeds must be Sized in order to be used as the internal state of a PRNG.
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
ToSmallVec
Convenience trait for constructing a SmallVec
TurboCore
Base trait for implementing a PRNG. Only one method must be implemented: TurboCore::fill_bytes, which provides the basis for any PRNG, to fill a buffer of bytes with random data.
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 implementing aHash, a high speed keyed hashing algorithm intended for use in in-memory hashmaps.
HashSet
A HashSet implementing aHash, a high speed keyed hashing algorithm intended for use in in-memory hashmaps.
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