chore: rename all &cx to cx, make clipppy happy
This commit is contained in:
1 parent
e8133e9449
commit
4eefc3f854
85 files changed
+256
-271
No files matched your search
@@ -41,7 +41,7 @@ struct BoxProps {
|
||||
}
|
||||
#[allow(non_snake_case)]
|
||||
fn Box(cx: Scope<BoxProps>) -> Element {
|
||||
let count = use_state(&cx, || 0);
|
||||
let count = use_state(cx, || 0);
|
||||
|
||||
let x = cx.props.x * 2;
|
||||
let y = cx.props.y * 2;
|
||||
@@ -70,8 +70,8 @@ struct GridProps {
|
||||
#[allow(non_snake_case)]
|
||||
fn Grid(cx: Scope<GridProps>) -> Element {
|
||||
let size = cx.props.size;
|
||||
let count = use_state(&cx, || 0);
|
||||
let counts = use_ref(&cx, || vec![0; size * size]);
|
||||
let count = use_state(cx, || 0);
|
||||
let counts = use_ref(cx, || vec![0; size * size]);
|
||||
|
||||
let ctx: &TuiContext = cx.consume_context().unwrap();
|
||||
if *count.get() + 1 >= (size * size) {
|
||||
|
||||
@@ -27,7 +27,7 @@ enum Event {
|
||||
const MAX_EVENTS: usize = 8;
|
||||
|
||||
fn app(cx: Scope) -> Element {
|
||||
let events = use_ref(&cx, Vec::new);
|
||||
let events = use_ref(cx, Vec::new);
|
||||
|
||||
let events_lock = events.read();
|
||||
let first_index = events_lock.len().saturating_sub(MAX_EVENTS);
|
||||
|
||||
@@ -5,7 +5,7 @@ fn main() {
|
||||
}
|
||||
|
||||
fn app(cx: Scope) -> Element {
|
||||
let radius = use_state(&cx, || 0);
|
||||
let radius = use_state(cx, || 0);
|
||||
|
||||
cx.render(rsx! {
|
||||
div {
|
||||
|
||||
@@ -13,8 +13,8 @@ struct ButtonProps {
|
||||
|
||||
#[allow(non_snake_case)]
|
||||
fn Button(cx: Scope<ButtonProps>) -> Element {
|
||||
let toggle = use_state(&cx, || false);
|
||||
let hovered = use_state(&cx, || false);
|
||||
let toggle = use_state(cx, || false);
|
||||
let hovered = use_state(cx, || false);
|
||||
|
||||
let hue = cx.props.color_offset % 255;
|
||||
let saturation = if *toggle.get() { 50 } else { 25 } + if *hovered.get() { 50 } else { 25 };
|
||||
|
||||
@@ -8,8 +8,8 @@ fn main() {
|
||||
}
|
||||
|
||||
fn app(cx: Scope) -> Element {
|
||||
let hue = use_state(&cx, || 0.0);
|
||||
let brightness = use_state(&cx, || 0.0);
|
||||
let hue = use_state(cx, || 0.0);
|
||||
let brightness = use_state(cx, || 0.0);
|
||||
let tui_query: &Query = cx.consume_context().unwrap();
|
||||
// disable templates so that every node has an id and can be queried
|
||||
cx.render(rsx! {
|
||||
|
||||
@@ -17,20 +17,20 @@ fn app(cx: Scope) -> Element {
|
||||
127 * b
|
||||
}
|
||||
|
||||
let q1_color = use_state(&cx, || [200; 3]);
|
||||
let q2_color = use_state(&cx, || [200; 3]);
|
||||
let q3_color = use_state(&cx, || [200; 3]);
|
||||
let q4_color = use_state(&cx, || [200; 3]);
|
||||
let q1_color = use_state(cx, || [200; 3]);
|
||||
let q2_color = use_state(cx, || [200; 3]);
|
||||
let q3_color = use_state(cx, || [200; 3]);
|
||||
let q4_color = use_state(cx, || [200; 3]);
|
||||
|
||||
let q1_color_str = to_str(q1_color);
|
||||
let q2_color_str = to_str(q2_color);
|
||||
let q3_color_str = to_str(q3_color);
|
||||
let q4_color_str = to_str(q4_color);
|
||||
|
||||
let page_coordinates = use_state(&cx, || "".to_string());
|
||||
let element_coordinates = use_state(&cx, || "".to_string());
|
||||
let buttons = use_state(&cx, || "".to_string());
|
||||
let modifiers = use_state(&cx, || "".to_string());
|
||||
let page_coordinates = use_state(cx, || "".to_string());
|
||||
let element_coordinates = use_state(cx, || "".to_string());
|
||||
let buttons = use_state(cx, || "".to_string());
|
||||
let modifiers = use_state(cx, || "".to_string());
|
||||
|
||||
let update_data = move |event: Event<MouseData>| {
|
||||
let mouse_data = event.inner();
|
||||
|
||||
@@ -5,9 +5,9 @@ fn main() {
|
||||
}
|
||||
|
||||
fn app(cx: Scope) -> Element {
|
||||
let count = use_state(&cx, || 0);
|
||||
let count = use_state(cx, || 0);
|
||||
|
||||
use_future(&cx, (), move |_| {
|
||||
use_future(cx, (), move |_| {
|
||||
let count = count.to_owned();
|
||||
let update = cx.schedule_update();
|
||||
async move {
|
||||
|
||||
@@ -5,7 +5,7 @@ fn main() {
|
||||
}
|
||||
|
||||
fn app(cx: Scope) -> Element {
|
||||
let alpha = use_state(&cx, || 100);
|
||||
let alpha = use_state(cx, || 100);
|
||||
|
||||
cx.render(rsx! {
|
||||
div {
|
||||
|
||||
@@ -26,8 +26,8 @@ use crate::{layout_to_screen_space, TuiDom};
|
||||
/// }
|
||||
///
|
||||
/// fn app(cx: Scope) -> Element {
|
||||
/// let hue = use_state(&cx, || 0.0);
|
||||
/// let brightness = use_state(&cx, || 0.0);
|
||||
/// let hue = use_state(cx, || 0.0);
|
||||
/// let brightness = use_state(cx, || 0.0);
|
||||
/// let tui_query: Query = cx.consume_context().unwrap();
|
||||
/// cx.render(rsx! {
|
||||
/// div{
|
||||
|
||||
@@ -33,7 +33,7 @@ fn key_down() {
|
||||
dioxus_tui::launch_cfg(app, dioxus_tui::Config::new().with_headless());
|
||||
|
||||
fn app(cx: Scope) -> Element {
|
||||
let render_count = use_state(&cx, || 0);
|
||||
let render_count = use_state(cx, || 0);
|
||||
let tui_ctx: TuiContext = cx.consume_context().unwrap();
|
||||
let render_count_handle = render_count.clone();
|
||||
cx.spawn(async move {
|
||||
@@ -70,7 +70,7 @@ fn mouse_down() {
|
||||
dioxus_tui::launch_cfg(app, dioxus_tui::Config::new().with_headless());
|
||||
|
||||
fn app(cx: Scope) -> Element {
|
||||
let render_count = use_state(&cx, || 0);
|
||||
let render_count = use_state(cx, || 0);
|
||||
let tui_ctx: TuiContext = cx.consume_context().unwrap();
|
||||
let render_count_handle = render_count.clone();
|
||||
cx.spawn(async move {
|
||||
@@ -104,7 +104,7 @@ fn mouse_up() {
|
||||
dioxus_tui::launch_cfg(app, dioxus_tui::Config::new().with_headless());
|
||||
|
||||
fn app(cx: Scope) -> Element {
|
||||
let render_count = use_state(&cx, || 0);
|
||||
let render_count = use_state(cx, || 0);
|
||||
let tui_ctx: TuiContext = cx.consume_context().unwrap();
|
||||
let render_count_handle = render_count.clone();
|
||||
cx.spawn(async move {
|
||||
@@ -143,7 +143,7 @@ fn mouse_enter() {
|
||||
dioxus_tui::launch_cfg(app, dioxus_tui::Config::new().with_headless());
|
||||
|
||||
fn app(cx: Scope) -> Element {
|
||||
let render_count = use_state(&cx, || 0);
|
||||
let render_count = use_state(cx, || 0);
|
||||
let tui_ctx: TuiContext = cx.consume_context().unwrap();
|
||||
let render_count_handle = render_count.clone();
|
||||
cx.spawn(async move {
|
||||
@@ -182,7 +182,7 @@ fn mouse_exit() {
|
||||
dioxus_tui::launch_cfg(app, dioxus_tui::Config::new().with_headless());
|
||||
|
||||
fn app(cx: Scope) -> Element {
|
||||
let render_count = use_state(&cx, || 0);
|
||||
let render_count = use_state(cx, || 0);
|
||||
let tui_ctx: TuiContext = cx.consume_context().unwrap();
|
||||
let render_count_handle = render_count.clone();
|
||||
cx.spawn(async move {
|
||||
@@ -221,7 +221,7 @@ fn mouse_move() {
|
||||
dioxus_tui::launch_cfg(app, dioxus_tui::Config::new().with_headless());
|
||||
|
||||
fn app(cx: Scope) -> Element {
|
||||
let render_count = use_state(&cx, || 0);
|
||||
let render_count = use_state(cx, || 0);
|
||||
let tui_ctx: TuiContext = cx.consume_context().unwrap();
|
||||
let render_count_handle = render_count.clone();
|
||||
cx.spawn(async move {
|
||||
@@ -260,7 +260,7 @@ fn wheel() {
|
||||
dioxus_tui::launch_cfg(app, dioxus_tui::Config::new().with_headless());
|
||||
|
||||
fn app(cx: Scope) -> Element {
|
||||
let render_count = use_state(&cx, || 0);
|
||||
let render_count = use_state(cx, || 0);
|
||||
let tui_ctx: TuiContext = cx.consume_context().unwrap();
|
||||
let render_count_handle = render_count.clone();
|
||||
cx.spawn(async move {
|
||||
@@ -300,7 +300,7 @@ fn click() {
|
||||
dioxus_tui::launch_cfg(app, dioxus_tui::Config::new().with_headless());
|
||||
|
||||
fn app(cx: Scope) -> Element {
|
||||
let render_count = use_state(&cx, || 0);
|
||||
let render_count = use_state(cx, || 0);
|
||||
let tui_ctx: TuiContext = cx.consume_context().unwrap();
|
||||
let render_count_handle = render_count.clone();
|
||||
cx.spawn(async move {
|
||||
@@ -339,7 +339,7 @@ fn context_menu() {
|
||||
dioxus_tui::launch_cfg(app, dioxus_tui::Config::new().with_headless());
|
||||
|
||||
fn app(cx: Scope) -> Element {
|
||||
let render_count = use_state(&cx, || 0);
|
||||
let render_count = use_state(cx, || 0);
|
||||
let tui_ctx: TuiContext = cx.consume_context().unwrap();
|
||||
let render_count_handle = render_count.clone();
|
||||
cx.spawn(async move {
|
||||
|
||||
Reference in new issue
Block a user