Skip to main content

Module data_components

Module data_components 

Source
Expand description

Data components system for items and entities.

This module provides an ABI-stable component system where:

  • Vanilla components get dedicated enum variants for zero-cost typed access
  • Plugin components use opaque bytes (ComponentData::Other)

§Architecture

§Example

use steel_registry::data_components::vanilla_components::DAMAGE;

// Type-safe access (compile-time checked)
let damage: Option<&i32> = components.get(DAMAGE);
components.set(DAMAGE, Some(10));

// Raw access for plugins
let data = components.get_raw(&key)?;

Re-exports§

pub use components::Equippable;
pub use components::EquippableSlot;
pub use components::Tool;
pub use components::ToolRule;

Modules§

component_data 🔒
ABI-stable component data storage.
components
Individual component type definitions.
registry 🔒
Data component registry and storage types.
vanilla_components
Vanilla data component definitions and registration.

Structs§

ComponentEntry
Metadata for a registered component type.
DataComponentMap
Storage for component values.
DataComponentPatch
A patch representing modifications to a DataComponentMap.
DataComponentRegistry
Registry of all data component types.
DataComponentType
A typed handle for a data component.

Enums§

ComponentData
ABI-stable component value storage.
ComponentDataDiscriminant
Discriminant for ComponentData variants.
ComponentPatchEntry
Entry in a component patch.

Traits§

Component
Trait for types that can be converted to/from ComponentData.

Functions§

component_try_into
Attempts to extract a typed component from ComponentData.

Type Aliases§

ComponentEntryRef
NbtReader
Reader function for deserializing a component from NBT format.
NbtWriter
Writer function for serializing a component to NBT format.
NetworkReader
Reader function for deserializing a component from network format.
NetworkWriter
Writer function for serializing a component to network format.