From b2154cb6903bc2b39e4c0183f6b4e371ff7e8ab0 Mon Sep 17 00:00:00 2001 From: Matt Hunzinger Date: Tue, 26 Nov 2024 14:38:14 -0500 Subject: [PATCH] Rename Ref to Signal and Mut to SignalMut to avoid name conflicts --- README.md | 8 ++--- examples/ecs/counter.rs | 6 ++-- examples/ecs/http.rs | 9 ++---- examples/ecs/timer.rs | 6 ++-- src/compose.rs | 8 ++--- src/ecs.rs | 39 ++++++++++++------------ src/lib.rs | 66 ++++++++++++++++++++--------------------- 7 files changed, 70 insertions(+), 72 deletions(-) diff --git a/README.md b/README.md index 28fb902..724a31a 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ This crate provides a generic library that lets you define reactive components ( ```rust // Counter UI example. -use actuate::prelude::{Mut, *}; +use actuate::prelude::*; use bevy::prelude::*; // Counter composable. @@ -53,10 +53,10 @@ impl Compose for Counter { .content(( spawn(Text::new(format!("High five count: {}", count))), spawn(Text::new("Up high")).observe(move |_trigger: In>>| { - Mut::update(count, |x| *x += 1) + SignalMut::update(count, |x| *x += 1) }), spawn(Text::new("Down low")).observe(move |_trigger: In>>| { - Mut::update(count, |x| *x -= 1) + SignalMut::update(count, |x| *x -= 1) }), if *count == 0 { Some(spawn(Text::new("Gimme five!"))) @@ -107,7 +107,7 @@ struct App { impl Compose for App { fn compose(cx: Scope) -> impl Compose { // Get a mapped reference to the app's `name` field. - let name = Ref::map(cx.me(), |me| &me.name).into(); + let name = Signal::map(cx.me(), |me| &me.name).into(); User { name } } diff --git a/examples/ecs/counter.rs b/examples/ecs/counter.rs index 3bebc25..3be4d8a 100644 --- a/examples/ecs/counter.rs +++ b/examples/ecs/counter.rs @@ -1,6 +1,6 @@ // Counter UI example. -use actuate::prelude::{Mut, *}; +use actuate::prelude::*; use bevy::prelude::*; // Counter composable. @@ -20,10 +20,10 @@ impl Compose for Counter { .content(( spawn(Text::new(format!("High five count: {}", count))), spawn(Text::new("Up high")).observe(move |_trigger: In>>| { - Mut::update(count, |x| *x += 1) + SignalMut::update(count, |x| *x += 1) }), spawn(Text::new("Down low")).observe(move |_trigger: In>>| { - Mut::update(count, |x| *x -= 1) + SignalMut::update(count, |x| *x -= 1) }), if *count == 0 { Some(spawn(Text::new("Gimme five!"))) diff --git a/examples/ecs/http.rs b/examples/ecs/http.rs index 593b5cc..4f0f494 100644 --- a/examples/ecs/http.rs +++ b/examples/ecs/http.rs @@ -1,9 +1,6 @@ // HTTP UI example -use actuate::{ - executor::ExecutorContext, - prelude::{Mut, Ref, *}, -}; +use actuate::{executor::ExecutorContext, prelude::*}; use bevy::prelude::*; use serde::Deserialize; use std::collections::HashMap; @@ -34,7 +31,7 @@ impl Compose for Breed<'_> { ..default() }) .content(compose::from_iter( - Ref::map(cx.me(), |me| me.families), + Signal::map(cx.me(), |me| me.families), |family| spawn(Text::from(family.to_string())), )), )) @@ -63,7 +60,7 @@ impl Compose for BreedList { .await .unwrap(); - Mut::update(breeds, |breeds| *breeds = json.message); + SignalMut::update(breeds, |breeds| *breeds = json.message); }); // Render the currently loaded breeds. diff --git a/examples/ecs/timer.rs b/examples/ecs/timer.rs index 473cefc..e4e1af7 100644 --- a/examples/ecs/timer.rs +++ b/examples/ecs/timer.rs @@ -1,6 +1,6 @@ // Timer UI example. -use actuate::prelude::{Mut, *}; +use actuate::prelude::*; use bevy::prelude::*; // Timer composable. @@ -12,7 +12,9 @@ impl Compose for Timer { let current_time = use_mut(&cx, Time::default); // Use the `Time` resource from the ECS world, updating the `current_time`. - use_world(&cx, move |time: Res