Skip to main content

Signals

Struct Signals 

Source
pub struct Signals {
    pub values: HashMap<String, String>,
    pub dirty: HashSet<String>,
}
๐Ÿ‘ŽDeprecated since 0.0.1:

use lumen_core::property_store::PropertyStore instead - Signals is now a thin wrapper that mirrors writes through push_external_property and reads from the typed store. New systems should take Res<PropertyStore> / ResMut<PropertyStore>.

Expand description

Legacy reactive named-value store. Deprecated as of wave-D - internal lumen systems now read/write through PropertyStore keyed on PropertyKey::Global.

The struct is retained as a thin wrapper so external embedders and FFI consumers that still hold Res<Signals> references compile and continue working: set writes through to PropertyStore via the cross-thread push_external_property bus AND keeps a local string copy for the legacy &str-returning get signature, and a per-tick mirror system back-fills writes that landed directly on PropertyStore so signals.get(name) keeps surfacing the latest value regardless of which side wrote it.

The dirty field is still populated by Signals::set for legacy derive-style callers, but new code should call PropertyStore::dirty_global_names instead.

Fieldsยง

ยงvalues: HashMap<String, String>
๐Ÿ‘ŽDeprecated since 0.0.1:

use lumen_core::property_store::PropertyStore instead - Signals is now a thin wrapper that mirrors writes through push_external_property and reads from the typed store. New systems should take Res<PropertyStore> / ResMut<PropertyStore>.

Stringified reactive signal values keyed by name. Populated by Self::set and by the per-tick mirror_property_store_globals_to_signals back-mirror so legacy &str-returning get callers keep working post wave-D.

ยงdirty: HashSet<String>
๐Ÿ‘ŽDeprecated since 0.0.1:

use lumen_core::property_store::PropertyStore instead - Signals is now a thin wrapper that mirrors writes through push_external_property and reads from the typed store. New systems should take Res<PropertyStore> / ResMut<PropertyStore>.

Set of signal names whose value changed during this tick. Kept for the apply_derivations legacy path; new derivation-style consumers should peek PropertyStore::dirty_global_names instead.

Implementationsยง

Sourceยง

impl Signals

Source

pub fn set(&mut self, name: impl Into<String>, value: impl Into<String>)

Sets the signal name to value. Writes through to PropertyStore via the cross-thread push_external_property bus AND updates the local values map so legacy Signals::get callers observe the write synchronously. Records the name in Self::dirty when the value changed.

Source

pub fn get(&self, name: &str) -> Option<&str>

Returns the signalโ€™s value, or None when undefined.

Source

pub fn set_bool(&mut self, name: impl Into<String>, value: bool)

Typed convenience: stores value under name as "true" or "false". The underlying repr is still a String (the reactive store is type-erased), but funnelling boolean writes through this helper means call sites canโ€™t drift to "True", "1", or other look-alike strings that the compilerโ€™s <if eq="true"> body comparator wouldnโ€™t recognise.

Source

pub fn get_bool(&self, name: &str) -> Option<bool>

Typed convenience read for boolean signals written via Self::set_bool. Accepts the canonical "true" / "false" pair plus the common "1" / "0" alias for FFI / Rhai authors. Returns None when the signal is undefined OR carries a non-boolean value - the caller can then fall back to a default rather than treating an unrelated string as false.

Trait Implementationsยง

Sourceยง

impl Clone for Signals

Sourceยง

fn clone(&self) -> Signals

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) ยท Sourceยง

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Sourceยง

impl Component for Signals
where Self: Send + Sync + 'static,

Sourceยง

const STORAGE_TYPE: StorageType = bevy_ecs::component::StorageType::SparseSet

A constant indicating the storage type used for this component.
Sourceยง

type Mutability = Mutable

A marker type to assist Bevy with determining if this component is mutable, or immutable. Mutable components will have Component<Mutability = Mutable>, while immutable components will instead have Component<Mutability = Immutable>. Read more
Sourceยง

fn register_required_components( _requiree: ComponentId, required_components: &mut RequiredComponentsRegistrator<'_, '_>, )

Registers required components. Read more
Sourceยง

fn clone_behavior() -> ComponentCloneBehavior

Called when registering this component, allowing to override clone function (or disable cloning altogether) for this component. Read more
Sourceยง

fn relationship_accessor() -> Option<ComponentRelationshipAccessor<Self>>

Returns [ComponentRelationshipAccessor] required for working with relationships in dynamic contexts. Read more
ยง

fn on_add() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>

Gets the on_add [ComponentHook] for this Component if one is defined.
ยง

fn on_insert() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>

Gets the on_insert [ComponentHook] for this Component if one is defined.
ยง

fn on_discard() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>

Gets the on_discard [ComponentHook] for this Component if one is defined.
ยง

fn on_remove() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>

Gets the on_remove [ComponentHook] for this Component if one is defined.
ยง

fn on_despawn() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>

Gets the on_despawn [ComponentHook] for this Component if one is defined.
ยง

fn map_entities<E>(_this: &mut Self, _mapper: &mut E)
where E: EntityMapper,

Maps the entities on this component using the given EntityMapper. This is used to remap entities in contexts like scenes and entity cloning. When deriving Component, this is populated by annotating fields containing entities with #[entities] Read more
Sourceยง

impl Debug for Signals

Sourceยง

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Sourceยง

impl Default for Signals

Sourceยง

fn default() -> Signals

Returns the โ€œdefault valueโ€ for a type. Read more
Sourceยง

impl Resource for Signals
where Self: Send + Sync + 'static,

Auto Trait Implementationsยง

Blanket Implementationsยง

Sourceยง

impl<T> Any for T
where T: 'static + ?Sized,

Sourceยง

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Sourceยง

impl<T> Borrow<T> for T
where T: ?Sized,

Sourceยง

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Sourceยง

impl<T> BorrowMut<T> for T
where T: ?Sized,

Sourceยง

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
ยง

impl<C> Bundle for C
where C: Component,

ยง

fn component_ids( components: &mut ComponentsRegistrator<'_>, ) -> impl Iterator<Item = ComponentId> + use<C>

ยง

fn get_component_ids( components: &Components, ) -> impl Iterator<Item = Option<ComponentId>>

Return a iterator over this Bundleโ€™s component ids. This will be None if the component has not been registered.
ยง

impl<C> BundleFromComponents for C
where C: Component,

ยง

unsafe fn from_components<T, F>(ctx: &mut T, func: &mut F) -> C
where F: for<'a> FnMut(&'a mut T) -> OwningPtr<'a>,

Sourceยง

impl<T> CloneToUninit for T
where T: Clone,

Sourceยง

unsafe fn clone_to_uninit(&self, dest: *mut u8)

๐Ÿ”ฌThis is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
ยง

impl<C> DynamicBundle for C
where C: Component,

ยง

type Effect = ()

An operation on the entity that happens after inserting this bundle.
ยง

unsafe fn get_components( ptr: MovingPtr<'_, C>, func: &mut impl FnMut(StorageType, OwningPtr<'_>), ) -> <C as DynamicBundle>::Effect

Moves the components out of the bundle. Read more
ยง

unsafe fn apply_effect( _ptr: MovingPtr<'_, MaybeUninit<C>>, _entity: &mut EntityWorldMut<'_>, )

Applies the after-effects of spawning this bundle. Read more
Sourceยง

impl<T> From<T> for T

Sourceยง

fn from(t: T) -> T

Returns the argument unchanged.

ยง

impl<T> FromTemplate for T
where T: Clone + Default + Unpin,

ยง

type Template = T

The Template for this type.
ยง

impl<T> FromWorld for T
where T: Default,

ยง

fn from_world(_world: &mut World) -> T

Creates Self using default().

Sourceยง

impl<T, U> Into<U> for T
where U: From<T>,

Sourceยง

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

ยง

impl<T> IntoResult<T> for T

ยง

fn into_result(self) -> Result<T, RunSystemError>

Converts this type into the system output type.
ยง

impl<T> Template for T
where T: Clone + Default + Unpin,

ยง

type Output = T

The type of value produced by this Template.
ยง

fn build_template( &self, _context: &mut TemplateContext<'_, '_>, ) -> Result<<T as Template>::Output, BevyError>

Uses this template and the given entity context to produce a Template::Output.
ยง

fn clone_template(&self) -> T

Clones this template. See Clone.
Sourceยง

impl<T> ToOwned for T
where T: Clone,

Sourceยง

type Owned = T

The resulting type after obtaining ownership.
Sourceยง

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Sourceยง

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Sourceยง

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Sourceยง

type Error = Infallible

The type returned in the event of a conversion error.
Sourceยง

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Sourceยง

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Sourceยง

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Sourceยง

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
ยง

impl<T> ConditionalSend for T
where T: Send,