Skip to main content

Crate pybevy_core

Crate pybevy_core 

Source
Expand description

Core storage primitives and runtime registries for PyBevy

This crate provides the foundational types for PyBevy’s owned/borrowed pattern and the runtime type registry system that enables crate splitting.

§Storage Primitives

  • ValidityFlag / ValidityFlagWithMode - Runtime validity tracking
  • ValidityGuard - RAII guard for system execution scope
  • ValueStorage<T> - Generic storage for Copy types (Vec3, Quat, etc.)
  • FieldStorage<T> - Generic storage for non-Copy types (TextureAtlas, etc.)
  • BorrowableStorage / FromBorrowedStorage - Traits for borrowed field access

§Runtime Registries

  • ComponentBridge - Trait for component type bridges
  • AssetBridge - Trait for asset type bridges
  • PluginBridge - Trait for plugin type bridges
  • DynamicComponentRegistry - Runtime registry for component bridges
  • DynamicAssetRegistry - Runtime registry for asset bridges

The registry system allows feature crates (pybevy_audio, pybevy_light, etc.) to register their types without the core crate needing to import them at compile time, enabling independent compilation and faster incremental builds.

Re-exports§

pub use asset::NativeAsset;
pub use asset::PyAsset;
pub use asset_path::PyAssetPath;
pub use component::PyComponent;
pub use debug_snapshot::DebugSnapshot;
pub use debug_snapshot::ReloadMemorySnapshotInfo;
pub use entity::PyEntity;
pub use handle::PyHandle;
pub use handle::extract_handle_from_any;
pub use hierarchy::PyChildOf;
pub use hierarchy::PyChildren;
pub use hierarchy::PyChildrenIterator;
pub use materializable::PyMaterializable;
pub use message::PyMessage;
pub use message::PyMessageId;
pub use plugin::PluginBridge;
pub use plugin::PyPlugin;
pub use registry::AssetBridge;
pub use registry::BatchComponent;
pub use registry::BatchFieldMeta;
pub use registry::BatchableField;
pub use registry::ComponentBatchInsertFn;
pub use registry::ComponentBatchMeta;
pub use registry::ComponentBridge;
pub use registry::DynamicAssetRegistry;
pub use registry::DynamicComponentRegistry;
pub use registry::DynamicResourceRegistry;
pub use registry::ExtractFn;
pub use registry::MessageBridge;
pub use registry::PluginConfigs;
pub use registry::PyRustComponentBatch;
pub use registry::ResourceBridge;
pub use registry::batch_field_meta_for;
pub use registry::field_offset_view_meta_for;
pub use registry::set_field_from_numpy;
pub use reload_request::CustomComponentEntry;
pub use reload_request::CustomComponentInfo;
pub use reload_request::CustomResourceEntry;
pub use reload_request::CustomResourceInfo;
pub use reload_request::LastSystemError;
pub use reload_request::PendingReloadRequest;
pub use reload_request::PyResourceStorage;
pub use reload_request::ReloadRequestMode;
pub use reload_request::ReloadResult;
pub use resource::PyResource;
pub use uuid;

Modules§

asset
Asset base class and trait for PyBevy asset wrappers
asset_path
component
Base component class for PyBevy
component_storage
Generic component storage supporting both owned and borrowed instances
debug_snapshot
Cross-crate debug/performance snapshot.
entity
Entity wrapper for PyBevy
field_storage
Generic field storage supporting both owned and borrowed instances
handle
Asset handle wrapper for PyBevy
hierarchy
Hierarchy component wrappers
list_storage
Generic list storage supporting both owned and borrowed Vec instances
materializable
message
Message base types for PyBevy
plugin
Plugin base class and bridge trait for PyBevy
registry
Runtime type registries for PyBevy
reload_request
Cross-crate reload request mailbox and shared resources.
resource
Base resource class for PyBevy
resource_storage
Generic resource storage supporting both owned and borrowed instances
storage
Storage types for PyBevy wrappers
storage_error
PyO3-independent error types for storage operations
storage_traits
Core storage traits for PyBevy
validity_guard
Runtime validity checking for system parameters
value_storage
Generic value storage supporting both owned and borrowed instances
view_bridge
View API bridge trait for runtime type dispatch

Structs§

AssetStorage
Generic storage for PyBevy assets
ChildOfBridge
ChildrenBridge
ComponentStorage
Generic storage for PyBevy components
FieldOffset
Field metadata for View API access
FieldStorage
Generic storage for PyBevy field types (non-Copy types like TextureAtlas)
ListStorage
Generic storage for Vec fields
PyF32List
ResourceStorage
Generic storage for PyBevy resources
ValidityFlag
A validity flag that can be shared across multiple system parameters and checked to ensure they’re only used during system execution.
ValidityFlagWithMode
A wrapper around ValidityFlag that enforces a specific access mode
ValidityGuard
RAII guard that sets a validity flag to true on creation and automatically sets it to false when dropped.
ValueStorage
Generic storage for PyBevy value types (Copy types like Vec3, Quat, etc.)
ViewBridge
Bridge struct containing function pointers for View API operations

Enums§

AccessMode
Access mode for system parameters and query components
ComponentStorageInner
FieldStorageInner
ListStorageInner
ResourceStorageInner
StorageError
Errors returned by storage operations.
ValueStorageInner

Traits§

BorrowableStorage
Trait for storage types that can borrow field pointers with validity tracking
FromBorrowedStorage
Trait for Python wrapper types that can be created from borrowed storage
ViewFieldAccess
Trait for components that support View API field access

Functions§

normalize_index
Normalize Python index (supports negative indexing)
register_core_bridges
Register core component bridges with global registry. Call this from main crate during initialization.