From 543a075a6e05419629a16dc4ac8004da58be1ef8 Mon Sep 17 00:00:00 2001 From: Nicolas Date: Thu, 26 Sep 2024 21:12:55 +0200 Subject: [PATCH 01/16] Update egui_animation --- Cargo.lock | 159 +++++++++++++++++++------- Cargo.toml | 27 ++++- crates/egui_animation/src/collapse.rs | 13 ++- crates/egui_animation/src/lib.rs | 17 +-- 4 files changed, 155 insertions(+), 61 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4365c23..6eadadc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1224,21 +1224,31 @@ checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b" name = "ecolor" version = "0.28.1" source = "git+https://github.com/emilk/egui?branch=master#06f709481a4e5e74bec961544c77e9afcae265db" +dependencies = [ + "emath 0.28.1", +] + +[[package]] +name = "ecolor" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5629649a8ae57c73f175f4a96419905a8102cfbfcbce96ea25a826bbf468e990" dependencies = [ "bytemuck", "color-hex", - "emath", + "emath 0.29.0", ] [[package]] name = "eframe" -version = "0.28.1" -source = "git+https://github.com/emilk/egui?branch=master#06f709481a4e5e74bec961544c77e9afcae265db" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712634e63d86f5eb8e30f880bc4803b79dcc82539aec1a28fde86ed839daed24" dependencies = [ "ahash", "bytemuck", "document-features", - "egui", + "egui 0.29.0", "egui-wgpu", "egui-winit", "egui_glow", @@ -1268,25 +1278,38 @@ dependencies = [ name = "egui" version = "0.28.1" source = "git+https://github.com/emilk/egui?branch=master#06f709481a4e5e74bec961544c77e9afcae265db" +dependencies = [ + "ahash", + "emath 0.28.1", + "epaint 0.28.1", + "nohash-hasher", +] + +[[package]] +name = "egui" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26bab3b3572566257a497b5f87d2cccaf7f7f122d4b8b620cba0493becc7955e" dependencies = [ "accesskit", "ahash", - "emath", - "epaint", + "emath 0.29.0", + "epaint 0.29.0", "log", "nohash-hasher", ] [[package]] name = "egui-wgpu" -version = "0.28.1" -source = "git+https://github.com/emilk/egui?branch=master#06f709481a4e5e74bec961544c77e9afcae265db" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba69456826abf572ed95b658b265c01f07a23d615d6f029eedc9ee5f13ddf788" dependencies = [ "ahash", "bytemuck", "document-features", - "egui", - "epaint", + "egui 0.29.0", + "epaint 0.29.0", "log", "thiserror", "type-map", @@ -1297,13 +1320,14 @@ dependencies = [ [[package]] name = "egui-winit" -version = "0.28.1" -source = "git+https://github.com/emilk/egui?branch=master#06f709481a4e5e74bec961544c77e9afcae265db" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "642c749bf221b5a3ecae3144c98b837729d87b9fde6c39a6ad00f07b71dbee94" dependencies = [ "accesskit_winit", "ahash", "arboard", - "egui", + "egui 0.29.0", "log", "raw-window-handle 0.6.2", "smithay-clipboard", @@ -1317,7 +1341,7 @@ name = "egui_animation" version = "0.5.0" dependencies = [ "eframe", - "egui", + "egui 0.29.0", "hello_egui_utils", "rand 0.8.5", "simple-easing", @@ -1329,9 +1353,9 @@ version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fe88871b75bd43c52a2b44ce5b53160506e7976e239112c56728496d019cc60d" dependencies = [ - "egui", + "egui 0.28.1", "egui_commonmark_backend", - "egui_extras", + "egui_extras 0.28.1", "pulldown-cmark", ] @@ -1341,8 +1365,8 @@ version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "148edd9546feba319b16d5a5e551cda46095031ec1e6665e5871eef9ee692967" dependencies = [ - "egui", - "egui_extras", + "egui 0.28.1", + "egui_extras 0.28.1", "pulldown-cmark", ] @@ -1352,9 +1376,9 @@ version = "0.9.1" dependencies = [ "color-hex", "eframe", - "egui", + "egui 0.29.0", "egui_animation", - "egui_extras", + "egui_extras 0.29.0", "egui_infinite_scroll", "egui_virtual_list", "hello_egui_utils", @@ -1369,7 +1393,21 @@ version = "0.28.1" source = "git+https://github.com/emilk/egui?branch=master#06f709481a4e5e74bec961544c77e9afcae265db" dependencies = [ "ahash", - "egui", + "egui 0.28.1", + "enum-map", + "image", + "log", + "mime_guess2", +] + +[[package]] +name = "egui_extras" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9f1beb57a3c942fac2f058655188c79ac1cd200555e4f3684cd0c965ceb3a67" +dependencies = [ + "ahash", + "egui 0.29.0", "ehttp", "enum-map", "image", @@ -1382,7 +1420,7 @@ name = "egui_flex" version = "0.1.0" dependencies = [ "eframe", - "egui", + "egui 0.29.0", "egui_inbox", ] @@ -1391,19 +1429,20 @@ name = "egui_form" version = "0.2.0" dependencies = [ "eframe", - "egui", + "egui 0.29.0", "garde", "validator", ] [[package]] name = "egui_glow" -version = "0.28.1" -source = "git+https://github.com/emilk/egui?branch=master#06f709481a4e5e74bec961544c77e9afcae265db" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea182206896187f7a2fcc207a1573785fc31330cb245f6cebcf663ea933f8d20" dependencies = [ "ahash", "bytemuck", - "egui", + "egui 0.29.0", "glow 0.14.0", "log", "memoffset 0.9.1", @@ -1418,7 +1457,7 @@ version = "0.5.0" dependencies = [ "derive-new", "eframe", - "egui", + "egui 0.29.0", "ehttp", "futures", "futures-channel", @@ -1435,8 +1474,8 @@ name = "egui_infinite_scroll" version = "0.4.0" dependencies = [ "eframe", - "egui", - "egui_extras", + "egui 0.29.0", + "egui_extras 0.29.0", "egui_inbox", "egui_virtual_list", "hello_egui_utils", @@ -1450,7 +1489,7 @@ name = "egui_pull_to_refresh" version = "0.5.0" dependencies = [ "eframe", - "egui", + "egui 0.29.0", "egui_inbox", "ehttp", ] @@ -1460,7 +1499,7 @@ name = "egui_router" version = "0.1.2" dependencies = [ "eframe", - "egui", + "egui 0.29.0", "egui_animation", "egui_inbox", "egui_suspense", @@ -1478,7 +1517,7 @@ name = "egui_suspense" version = "0.5.0" dependencies = [ "eframe", - "egui", + "egui 0.29.0", "egui_inbox", "futures", "hello_egui_utils", @@ -1492,7 +1531,7 @@ name = "egui_taffy" version = "0.1.0" dependencies = [ "eframe", - "egui", + "egui 0.29.0", "rand 0.8.5", "taffy", ] @@ -1503,8 +1542,8 @@ version = "0.4.0" dependencies = [ "base64", "eframe", - "egui", - "egui_extras", + "egui 0.29.0", + "egui_extras 0.29.0", "image", "oxhttp", "serde", @@ -1517,7 +1556,7 @@ name = "egui_virtual_list" version = "0.4.0" dependencies = [ "eframe", - "egui", + "egui 0.29.0", "rand 0.8.5", "web-time", ] @@ -1528,8 +1567,8 @@ version = "0.1.0" dependencies = [ "base64", "eframe", - "egui", - "egui_extras", + "egui 0.29.0", + "egui_extras 0.29.0", "egui_inbox", "image", "log", @@ -1565,6 +1604,12 @@ checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" name = "emath" version = "0.28.1" source = "git+https://github.com/emilk/egui?branch=master#06f709481a4e5e74bec961544c77e9afcae265db" + +[[package]] +name = "emath" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af86c4efae11da2a3dcbb4afebd0e9ed1916345e8d187b4051d443c8bd79af93" dependencies = [ "bytemuck", ] @@ -1624,13 +1669,28 @@ dependencies = [ name = "epaint" version = "0.28.1" source = "git+https://github.com/emilk/egui?branch=master#06f709481a4e5e74bec961544c77e9afcae265db" +dependencies = [ + "ab_glyph", + "ahash", + "ecolor 0.28.1", + "emath 0.28.1", + "epaint_default_fonts 0.28.1", + "nohash-hasher", + "parking_lot", +] + +[[package]] +name = "epaint" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "445e11ec86a4d85e1350578ba20b2d89977ed937f3faab32e1c3ec81d20c1842" dependencies = [ "ab_glyph", "ahash", "bytemuck", - "ecolor", - "emath", - "epaint_default_fonts", + "ecolor 0.29.0", + "emath 0.29.0", + "epaint_default_fonts 0.29.0", "log", "nohash-hasher", "parking_lot", @@ -1641,6 +1701,12 @@ name = "epaint_default_fonts" version = "0.28.1" source = "git+https://github.com/emilk/egui?branch=master#06f709481a4e5e74bec961544c77e9afcae265db" +[[package]] +name = "epaint_default_fonts" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5202b64bef2b2c42a7f6e2e5b40fa83dd04aa61fdb08bfd116553adc149fe47a" + [[package]] name = "equivalent" version = "1.0.1" @@ -1724,11 +1790,11 @@ dependencies = [ "casey", "color-hex", "eframe", - "egui", + "egui 0.29.0", "egui_animation", "egui_commonmark", "egui_dnd", - "egui_extras", + "egui_extras 0.29.0", "egui_flex", "egui_form", "egui_inbox", @@ -2572,7 +2638,7 @@ name = "hello_egui_utils" version = "0.5.0" dependencies = [ "concat-idents", - "egui", + "egui 0.29.0", "tokio", "wasm-bindgen-futures", ] @@ -6720,3 +6786,8 @@ dependencies = [ "quote", "syn 1.0.109", ] + +[[patch.unused]] +name = "eframe" +version = "0.28.1" +source = "git+https://github.com/emilk/egui?branch=master#06f709481a4e5e74bec961544c77e9afcae265db" diff --git a/Cargo.toml b/Cargo.toml index 482985a..365b34e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,11 +15,28 @@ tag-prefix = "hello_egui-" all-features = true [features] -all = ["animation", "dnd", "flex", "form", "inbox", "infinite_scroll", "pull_to_refresh", "router", "suspense", "thumbhash", "virtual_list"] +all = [ + "animation", + "dnd", + "flex", + "form", + "inbox", + "infinite_scroll", + "pull_to_refresh", + "router", + "suspense", + "thumbhash", + "virtual_list", +] full = ["all", "async", "tokio"] animation = ["dep:egui_animation"] -async = ["egui_suspense/async", "egui_infinite_scroll/async", "egui_router/async", "egui_inbox/async"] +async = [ + "egui_suspense/async", + "egui_infinite_scroll/async", + "egui_router/async", + "egui_inbox/async", +] dnd = ["dep:egui_dnd"] flex = ["dep:egui_flex"] form = ["dep:egui_form"] @@ -65,9 +82,9 @@ egui_infinite_scroll = { path = "./crates/egui_infinite_scroll", version = "0.4. egui_thumbhash = { path = "./crates/egui_thumbhash", version = "0.4.0" } hello_egui = { path = ".", version = "0.5.0" } -egui = { version = "0.28.0", default-features = false } -eframe = { version = "0.28.0", default-features = false } -egui_extras = { version = "0.28.0", default-features = false } +egui = { version = "0.29.0", default-features = false } +eframe = { version = "0.29.0", default-features = false } +egui_extras = { version = "0.29.0", default-features = false } [patch.crates-io] #wry = { path = "../../RustroverProjects/github/wry" } diff --git a/crates/egui_animation/src/collapse.rs b/crates/egui_animation/src/collapse.rs index fd2c6df..9ed0cf5 100644 --- a/crates/egui_animation/src/collapse.rs +++ b/crates/egui_animation/src/collapse.rs @@ -1,5 +1,5 @@ use crate::animate_bool_eased; -use egui::{Id, Rect, Ui, Vec2}; +use egui::{Id, Rect, Ui, UiBuilder, Vec2}; /// Collapse animation to hide/show content. /// Currently only vertical collapse is supported. @@ -49,10 +49,13 @@ impl Collapse { .ctx() .memory_mut(|mem| *mem.data.get_temp_mut_or(id, 0.0)); - let mut child = ui.child_ui( - Rect::from_min_size(ui.next_widget_position(), ui.available_size()), - *ui.layout(), - None, + let mut child = ui.new_child( + UiBuilder::new() + .max_rect(Rect::from_min_size( + ui.next_widget_position(), + ui.available_size(), + )) + .layout(*ui.layout()), ); let current_size = last_size * x; diff --git a/crates/egui_animation/src/lib.rs b/crates/egui_animation/src/lib.rs index 25b2ec0..3099b58 100644 --- a/crates/egui_animation/src/lib.rs +++ b/crates/egui_animation/src/lib.rs @@ -14,7 +14,7 @@ pub mod easing { } pub use collapse::*; -use egui::{Context, Id, Pos2, Rect, Sense, Ui, Vec2}; +use egui::{Context, Id, Pos2, Rect, Sense, Ui, UiBuilder, Vec2}; use hello_egui_utils::current_scroll_delta; #[derive(Debug, Clone)] @@ -115,14 +115,17 @@ pub fn animate_ui_translation( let current_pos = animate_position(ui, id, target_pos, 1.0, easing, prevent_scroll_animation); - let mut child = ui.child_ui(rect, *ui.layout(), None); + let mut child = ui.new_child(UiBuilder::new().max_rect(rect).layout(*ui.layout())); let _response = child - .allocate_ui_at_rect(Rect::from_min_size(current_pos, rect.size()), |ui| { - ui.allocate_ui(size, |ui| { - content(ui); - }); - }) + .allocate_new_ui( + UiBuilder::new().max_rect(Rect::from_min_size(current_pos, rect.size())), + |ui| { + ui.allocate_ui(size, |ui| { + content(ui); + }); + }, + ) .response; rect From d5ca0c5354eac5ecd8ed195dbf8a34794d6f6e09 Mon Sep 17 00:00:00 2001 From: Nicolas Date: Thu, 26 Sep 2024 21:22:07 +0200 Subject: [PATCH 02/16] Update egui_dnd --- crates/egui_dnd/src/item.rs | 70 ++++++++++++++++------------ crates/egui_dnd/src/item_iterator.rs | 15 ++++-- 2 files changed, 51 insertions(+), 34 deletions(-) diff --git a/crates/egui_dnd/src/item.rs b/crates/egui_dnd/src/item.rs index b489936..61d0bdc 100644 --- a/crates/egui_dnd/src/item.rs +++ b/crates/egui_dnd/src/item.rs @@ -1,4 +1,6 @@ -use egui::{CursorIcon, Id, InnerResponse, LayerId, Layout, Order, Pos2, Rect, Sense, Ui, Vec2}; +use egui::{ + CursorIcon, Id, InnerResponse, LayerId, Layout, Order, Pos2, Rect, Sense, Ui, UiBuilder, Vec2, +}; use egui_animation::animate_position; use crate::state::DragDetectionState; @@ -173,21 +175,24 @@ impl<'a> Item<'a> { rect.min }; - let mut child = ui.child_ui(rect, *ui.layout(), None); + let mut child = ui.new_child(UiBuilder::new().max_rect(rect).layout(*ui.layout())); - child.allocate_ui_at_rect(Rect::from_min_size(position, rect.size()), |ui| { - drag_body( - ui, - Handle::new( - id, - index, - self.dnd_state, - hovering_over_any_handle, - rect.min, - ), - self.state, - ) - }); + child.allocate_new_ui( + UiBuilder::new().max_rect(Rect::from_min_size(position, rect.size())), + |ui| { + drag_body( + ui, + Handle::new( + id, + index, + self.dnd_state, + hovering_over_any_handle, + rect.min, + ), + self.state, + ) + }, + ); rect } else { @@ -210,20 +215,27 @@ impl<'a> Item<'a> { let size = ui.available_size(); - let mut child = ui.child_ui(ui.max_rect(), *ui.layout(), None); - let response = child.allocate_ui_at_rect(Rect::from_min_size(position, size), |ui| { - drag_body( - ui, - Handle::new( - id, - index, - self.dnd_state, - hovering_over_any_handle, - animated_position, - ), - self.state, - ) - }); + let mut child = ui.new_child( + UiBuilder::new() + .max_rect(ui.max_rect()) + .layout(*ui.layout()), + ); + let response = child.allocate_new_ui( + UiBuilder::new().max_rect(Rect::from_min_size(position, size)), + |ui| { + drag_body( + ui, + Handle::new( + id, + index, + self.dnd_state, + hovering_over_any_handle, + animated_position, + ), + self.state, + ) + }, + ); ui.allocate_space(response.response.rect.size()).1 }; diff --git a/crates/egui_dnd/src/item_iterator.rs b/crates/egui_dnd/src/item_iterator.rs index 844f6ce..517cc63 100644 --- a/crates/egui_dnd/src/item_iterator.rs +++ b/crates/egui_dnd/src/item_iterator.rs @@ -1,7 +1,7 @@ use crate::item::{Item, ItemResponse}; use crate::state::DragDetectionState; use crate::{DragDropUi, ItemState}; -use egui::{Id, Layout, Pos2, Rect, Ui, Vec2}; +use egui::{Id, Layout, Pos2, Rect, Ui, UiBuilder, Vec2}; /// Calculates some information that is later used to detect in which index the dragged item should be placed. /// [ItemIterator::next] should be called for each item in the list. @@ -110,12 +110,17 @@ impl<'a> ItemIterator<'a> { ); let rect = if is_dragged_item { if let Some((_id, pos)) = self.hovering_item { - let mut child = ui.child_ui(ui.available_rect_before_wrap(), *ui.layout(), None); + let mut child = ui.new_child( + UiBuilder::new() + .max_rect(ui.available_rect_before_wrap()) + .layout(*ui.layout()), + ); let start = ui.next_widget_position(); let rect = child - .allocate_ui_at_rect(Rect::from_min_size(pos, child.available_size()), |ui| { - content(ui, item) - }) + .allocate_new_ui( + UiBuilder::new().max_rect(Rect::from_min_size(pos, child.available_size())), + |ui| content(ui, item), + ) .inner .0; Rect::from_min_size(start, rect.size()) From 330db50cae99f3e28785b3a1fb4c46fefe2e11ae Mon Sep 17 00:00:00 2001 From: Nicolas Date: Thu, 26 Sep 2024 21:32:21 +0200 Subject: [PATCH 03/16] update egui_pull_to_refresh --- crates/egui_pull_to_refresh/src/lib.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/egui_pull_to_refresh/src/lib.rs b/crates/egui_pull_to_refresh/src/lib.rs index 0784736..be85db0 100644 --- a/crates/egui_pull_to_refresh/src/lib.rs +++ b/crates/egui_pull_to_refresh/src/lib.rs @@ -3,7 +3,7 @@ #![warn(missing_docs)] use egui::scroll_area::ScrollAreaOutput; -use egui::{Align2, Area, Color32, Id, Rect, Sense, Ui, Vec2}; +use egui::{Align2, Area, Color32, Id, Rect, Sense, Ui, UiBuilder, Vec2}; use crate::progress_spinner::ProgressSpinner; @@ -103,7 +103,11 @@ impl PullToRefresh { ui: &mut Ui, content: impl FnOnce(&mut Ui) -> T, ) -> PullToRefreshResponse { - let mut child = ui.child_ui(ui.available_rect_before_wrap(), *ui.layout(), None); + let mut child = ui.new_child( + UiBuilder::new() + .max_rect(ui.available_rect_before_wrap()) + .layout(*ui.layout()), + ); let output = content(&mut child); From 108f8e2c0431fb796ceb19179250e13660198960 Mon Sep 17 00:00:00 2001 From: Nicolas Date: Thu, 26 Sep 2024 21:32:29 +0200 Subject: [PATCH 04/16] update egui_router --- crates/egui_router/src/transition.rs | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/crates/egui_router/src/transition.rs b/crates/egui_router/src/transition.rs index f5bf99d..919574c 100644 --- a/crates/egui_router/src/transition.rs +++ b/crates/egui_router/src/transition.rs @@ -1,5 +1,5 @@ use crate::TransitionConfig; -use egui::{Id, Ui, Vec2}; +use egui::{Id, Ui, UiBuilder, Vec2}; /// Trait for declaring a transition. /// Prefer [ComposableTransitionTrait] unless you need to create a new ui to apply the transition. @@ -16,7 +16,12 @@ pub trait ComposableTransitionTrait { impl TransitionTrait for T { fn create_child_ui(&self, ui: &mut Ui, t: f32, with_id: Id) -> Ui { - let mut child = ui.child_ui_with_id_source(ui.max_rect(), *ui.layout(), with_id, None); + let mut child = ui.new_child( + UiBuilder::new() + .max_rect(ui.max_rect()) + .layout(*ui.layout()) + .id_salt(with_id), + ); self.apply(&mut child, t); child } @@ -96,7 +101,12 @@ impl TransitionTrait for SlideTransition { let offset = available_size * (1.0 - t) * self.amount; let child_rect = ui.max_rect().translate(offset); - ui.child_ui_with_id_source(child_rect, *ui.layout(), with_id, None) + ui.new_child( + UiBuilder::new() + .max_rect(child_rect) + .layout(*ui.layout()) + .id_salt(with_id), + ) } } @@ -261,11 +271,11 @@ impl ActiveTransition { pub fn show_default(ui: &mut Ui, with_id: usize, content: impl FnOnce(&mut Ui)) { with_temp_auto_id(ui, with_id, |ui| { - let mut ui = ui.child_ui_with_id_source( - ui.max_rect(), - *ui.layout(), - Id::new("router_child").with(with_id), - None, + let mut ui = ui.new_child( + UiBuilder::new() + .max_rect(ui.max_rect()) + .layout(*ui.layout()) + .id_salt(Id::new("router_child").with(with_id)), ); content(&mut ui); }); From 1c5e2f34d9aab2c3ba06234e83837bd031308f12 Mon Sep 17 00:00:00 2001 From: Nicolas Date: Thu, 26 Sep 2024 21:37:08 +0200 Subject: [PATCH 05/16] update egui_taffy --- crates/egui_taffy/src/lib.rs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/crates/egui_taffy/src/lib.rs b/crates/egui_taffy/src/lib.rs index 6933c50..480f945 100644 --- a/crates/egui_taffy/src/lib.rs +++ b/crates/egui_taffy/src/lib.rs @@ -1,7 +1,7 @@ use std::collections::HashMap; use egui::util::IdTypeMap; -use egui::{Context, Id, LayerId, Order, Pos2, Ui, UiStackInfo}; +use egui::{Context, Id, LayerId, Order, Pos2, Ui, UiBuilder, UiStackInfo}; use taffy::prelude::*; pub use taffy; @@ -254,10 +254,14 @@ impl<'a, 'f> TaffyPass<'a, 'f> { ctx.clone(), LayerId::new(Order::Background, Id::new("measure")), Id::new("measure"), - rect, - egui::Rect::from_min_size(Default::default(), Default::default()), - UiStackInfo::default(), + UiBuilder::new() + .max_rect(rect) + .ui_stack_info(UiStackInfo::default()), ); + ui.set_clip_rect(egui::Rect::from_min_size( + Default::default(), + Default::default(), + )); let response = ui.with_layout( egui::Layout { main_dir: layout.main_dir, @@ -348,7 +352,9 @@ impl<'a, 'f> TaffyPass<'a, 'f> { return; } - let mut child = self.ui.child_ui(rect, *egui_layout, None); + let mut child = self + .ui + .new_child(UiBuilder::new().max_rect(rect).layout(*egui_layout)); content(&mut child); } From ff4d08b161e59e5baed5f4ab7254961a9ca1c1b0 Mon Sep 17 00:00:00 2001 From: Nicolas Date: Thu, 26 Sep 2024 21:39:34 +0200 Subject: [PATCH 06/16] update hello_egui_utils --- crates/hello_egui_utils/src/center.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/hello_egui_utils/src/center.rs b/crates/hello_egui_utils/src/center.rs index 2a389e6..ed8d2b6 100644 --- a/crates/hello_egui_utils/src/center.rs +++ b/crates/hello_egui_utils/src/center.rs @@ -1,4 +1,4 @@ -use egui::{Align2, Id, Rect, Ui, Vec2}; +use egui::{Align2, Id, Rect, Ui, UiBuilder, Vec2}; /// A widget that measures its content and centers it within the available space. pub struct Center { @@ -48,7 +48,7 @@ impl Center { rect }; - let mut ui = ui.child_ui(content_rect, *ui.layout(), None); + let mut ui = ui.new_child(UiBuilder::new().max_rect(content_rect).layout(*ui.layout())); if last_size.is_none() { ui.set_invisible(); From 6c4f6697eb56ba8055a329586e818aad9f31dc6c Mon Sep 17 00:00:00 2001 From: Nicolas Date: Thu, 26 Sep 2024 21:39:36 +0200 Subject: [PATCH 07/16] update egui_virtual_list --- crates/egui_virtual_list/src/lib.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/egui_virtual_list/src/lib.rs b/crates/egui_virtual_list/src/lib.rs index e784d65..84ce6d0 100644 --- a/crates/egui_virtual_list/src/lib.rs +++ b/crates/egui_virtual_list/src/lib.rs @@ -4,7 +4,7 @@ use std::ops::Range; -use egui::{Align, Pos2, Rect, Ui, Vec2}; +use egui::{Align, Pos2, Rect, Ui, UiBuilder, Vec2}; use web_time::{Duration, SystemTime}; /// The response from a call to [`VirtualList::ui_custom_layout`] @@ -169,7 +169,11 @@ impl VirtualList { // to maintain the scroll position let scroll_items_top_step_2 = if let Some(scroll_top_items) = self.items_inserted_at_start.take() { - let mut measure_ui = ui.child_ui(ui.max_rect(), *ui.layout(), None); + let mut measure_ui = ui.new_child( + UiBuilder::new() + .max_rect(ui.max_rect()) + .layout(*ui.layout()), + ); measure_ui.set_invisible(); let start_height = measure_ui.next_widget_position(); From 6bc160550c86e153f91f7b31e06fbbaf1a53bb13 Mon Sep 17 00:00:00 2001 From: Nicolas Date: Thu, 26 Sep 2024 21:40:03 +0200 Subject: [PATCH 08/16] update hello_egui_utils --- crates/hello_egui_utils/src/lib.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/crates/hello_egui_utils/src/lib.rs b/crates/hello_egui_utils/src/lib.rs index 2458ff5..24a59bb 100644 --- a/crates/hello_egui_utils/src/lib.rs +++ b/crates/hello_egui_utils/src/lib.rs @@ -5,18 +5,20 @@ /// Helper struct to easily align things with unknown sizes pub mod center; -use egui::{Align, Label, Layout, Ui, Vec2, WidgetText}; +use egui::{Align, Label, Layout, Ui, UiBuilder, Vec2, WidgetText}; pub use concat_idents::concat_idents; /// Returns the size of the text in the current ui (based on the max width of the ui) pub fn measure_text(ui: &mut Ui, text: impl Into) -> Vec2 { // There might be a more elegant way but this is enough for now - let res = Label::new(text).layout_in_ui(&mut ui.child_ui( - ui.available_rect_before_wrap(), - Layout::left_to_right(Align::Center), - None, - )); + let res = Label::new(text).layout_in_ui( + &mut ui.new_child( + UiBuilder::new() + .max_rect(ui.available_rect_before_wrap()) + .layout(Layout::left_to_right(Align::Center)), + ), + ); // There seem to be rounding errors in egui's text rendering // so we add a little bit of padding From 6e949dd0627a3af86b9eb0026e1016d981806720 Mon Sep 17 00:00:00 2001 From: Nicolas Date: Thu, 26 Sep 2024 21:44:46 +0200 Subject: [PATCH 09/16] update egui_flex --- crates/egui_flex/examples/flex_customize_example.rs | 3 ++- crates/egui_flex/examples/flex_nested.rs | 2 +- crates/egui_flex/src/lib.rs | 5 +++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/crates/egui_flex/examples/flex_customize_example.rs b/crates/egui_flex/examples/flex_customize_example.rs index f09288f..ac5cee0 100644 --- a/crates/egui_flex/examples/flex_customize_example.rs +++ b/crates/egui_flex/examples/flex_customize_example.rs @@ -121,5 +121,6 @@ fn main() { }); }); }, - ); + ) + .unwrap(); } diff --git a/crates/egui_flex/examples/flex_nested.rs b/crates/egui_flex/examples/flex_nested.rs index 5e2b839..64c1a05 100644 --- a/crates/egui_flex/examples/flex_nested.rs +++ b/crates/egui_flex/examples/flex_nested.rs @@ -1,4 +1,4 @@ -use egui::{Button, CentralPanel, Checkbox, DragValue, Frame, Slider, TextEdit, Vec2}; +use egui::{Button, CentralPanel, Checkbox, DragValue, Frame, TextEdit, Vec2}; use egui_flex::{Flex, FlexAlignContent, FlexItem}; fn main() -> eframe::Result { diff --git a/crates/egui_flex/src/lib.rs b/crates/egui_flex/src/lib.rs index 9242643..ad23869 100644 --- a/crates/egui_flex/src/lib.rs +++ b/crates/egui_flex/src/lib.rs @@ -612,7 +612,8 @@ impl<'a> FlexInstance<'a> { // ); // } - let mut child_ui = ui.child_ui(frame_rect, *ui.layout(), None); + let mut child_ui = + ui.new_child(UiBuilder::new().max_rect(frame_rect).layout(*ui.layout())); child_ui.spacing_mut().item_spacing = self.item_spacing; let res = container_ui( @@ -841,7 +842,7 @@ impl FlexContainerUi { let child_rect = content_rect.intersect(ui.max_rect()); - let mut child = ui.child_ui(child_rect, *ui.layout(), None); + let mut child = ui.new_child(UiBuilder::new().max_rect(child_rect).layout(*ui.layout())); let r = content(&mut child); From 1c2c1860c648498778a28849ac24efd19248cae2 Mon Sep 17 00:00:00 2001 From: Nicolas Date: Thu, 26 Sep 2024 21:57:00 +0200 Subject: [PATCH 10/16] fix clippy errors --- Cargo.lock | 150 ++++++------------ .../examples/flex_customize_example.rs | 4 +- crates/egui_flex/examples/flex_example.rs | 8 +- crates/egui_flex/src/lib.rs | 54 ++----- fancy-example/Cargo.toml | 2 +- fancy-example/src/chat.rs | 9 +- fancy-example/src/crate_ui.rs | 22 ++- 7 files changed, 85 insertions(+), 164 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6eadadc..142141c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1220,14 +1220,6 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b" -[[package]] -name = "ecolor" -version = "0.28.1" -source = "git+https://github.com/emilk/egui?branch=master#06f709481a4e5e74bec961544c77e9afcae265db" -dependencies = [ - "emath 0.28.1", -] - [[package]] name = "ecolor" version = "0.29.0" @@ -1236,7 +1228,7 @@ checksum = "5629649a8ae57c73f175f4a96419905a8102cfbfcbce96ea25a826bbf468e990" dependencies = [ "bytemuck", "color-hex", - "emath 0.29.0", + "emath", ] [[package]] @@ -1248,7 +1240,7 @@ dependencies = [ "ahash", "bytemuck", "document-features", - "egui 0.29.0", + "egui", "egui-wgpu", "egui-winit", "egui_glow", @@ -1274,17 +1266,6 @@ dependencies = [ "winit", ] -[[package]] -name = "egui" -version = "0.28.1" -source = "git+https://github.com/emilk/egui?branch=master#06f709481a4e5e74bec961544c77e9afcae265db" -dependencies = [ - "ahash", - "emath 0.28.1", - "epaint 0.28.1", - "nohash-hasher", -] - [[package]] name = "egui" version = "0.29.0" @@ -1293,8 +1274,8 @@ checksum = "26bab3b3572566257a497b5f87d2cccaf7f7f122d4b8b620cba0493becc7955e" dependencies = [ "accesskit", "ahash", - "emath 0.29.0", - "epaint 0.29.0", + "emath", + "epaint", "log", "nohash-hasher", ] @@ -1308,8 +1289,8 @@ dependencies = [ "ahash", "bytemuck", "document-features", - "egui 0.29.0", - "epaint 0.29.0", + "egui", + "epaint", "log", "thiserror", "type-map", @@ -1327,7 +1308,7 @@ dependencies = [ "accesskit_winit", "ahash", "arboard", - "egui 0.29.0", + "egui", "log", "raw-window-handle 0.6.2", "smithay-clipboard", @@ -1341,7 +1322,7 @@ name = "egui_animation" version = "0.5.0" dependencies = [ "eframe", - "egui 0.29.0", + "egui", "hello_egui_utils", "rand 0.8.5", "simple-easing", @@ -1349,24 +1330,24 @@ dependencies = [ [[package]] name = "egui_commonmark" -version = "0.17.0" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe88871b75bd43c52a2b44ce5b53160506e7976e239112c56728496d019cc60d" +checksum = "6f169228b94d1c8eb9330b7ea1b5f65b1193b6bea95159c87f574ed4aff8c172" dependencies = [ - "egui 0.28.1", + "egui", "egui_commonmark_backend", - "egui_extras 0.28.1", + "egui_extras", "pulldown-cmark", ] [[package]] name = "egui_commonmark_backend" -version = "0.17.0" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "148edd9546feba319b16d5a5e551cda46095031ec1e6665e5871eef9ee692967" +checksum = "dcd08f95abeb137e59c9bfdd0880d362bff74a83afe13805fde7a2d014ef773d" dependencies = [ - "egui 0.28.1", - "egui_extras 0.28.1", + "egui", + "egui_extras", "pulldown-cmark", ] @@ -1376,9 +1357,9 @@ version = "0.9.1" dependencies = [ "color-hex", "eframe", - "egui 0.29.0", + "egui", "egui_animation", - "egui_extras 0.29.0", + "egui_extras", "egui_infinite_scroll", "egui_virtual_list", "hello_egui_utils", @@ -1387,19 +1368,6 @@ dependencies = [ "web-time", ] -[[package]] -name = "egui_extras" -version = "0.28.1" -source = "git+https://github.com/emilk/egui?branch=master#06f709481a4e5e74bec961544c77e9afcae265db" -dependencies = [ - "ahash", - "egui 0.28.1", - "enum-map", - "image", - "log", - "mime_guess2", -] - [[package]] name = "egui_extras" version = "0.29.0" @@ -1407,7 +1375,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9f1beb57a3c942fac2f058655188c79ac1cd200555e4f3684cd0c965ceb3a67" dependencies = [ "ahash", - "egui 0.29.0", + "egui", "ehttp", "enum-map", "image", @@ -1420,7 +1388,7 @@ name = "egui_flex" version = "0.1.0" dependencies = [ "eframe", - "egui 0.29.0", + "egui", "egui_inbox", ] @@ -1429,7 +1397,7 @@ name = "egui_form" version = "0.2.0" dependencies = [ "eframe", - "egui 0.29.0", + "egui", "garde", "validator", ] @@ -1442,7 +1410,7 @@ checksum = "ea182206896187f7a2fcc207a1573785fc31330cb245f6cebcf663ea933f8d20" dependencies = [ "ahash", "bytemuck", - "egui 0.29.0", + "egui", "glow 0.14.0", "log", "memoffset 0.9.1", @@ -1457,7 +1425,7 @@ version = "0.5.0" dependencies = [ "derive-new", "eframe", - "egui 0.29.0", + "egui", "ehttp", "futures", "futures-channel", @@ -1474,8 +1442,8 @@ name = "egui_infinite_scroll" version = "0.4.0" dependencies = [ "eframe", - "egui 0.29.0", - "egui_extras 0.29.0", + "egui", + "egui_extras", "egui_inbox", "egui_virtual_list", "hello_egui_utils", @@ -1489,7 +1457,7 @@ name = "egui_pull_to_refresh" version = "0.5.0" dependencies = [ "eframe", - "egui 0.29.0", + "egui", "egui_inbox", "ehttp", ] @@ -1499,7 +1467,7 @@ name = "egui_router" version = "0.1.2" dependencies = [ "eframe", - "egui 0.29.0", + "egui", "egui_animation", "egui_inbox", "egui_suspense", @@ -1517,7 +1485,7 @@ name = "egui_suspense" version = "0.5.0" dependencies = [ "eframe", - "egui 0.29.0", + "egui", "egui_inbox", "futures", "hello_egui_utils", @@ -1531,7 +1499,7 @@ name = "egui_taffy" version = "0.1.0" dependencies = [ "eframe", - "egui 0.29.0", + "egui", "rand 0.8.5", "taffy", ] @@ -1542,8 +1510,8 @@ version = "0.4.0" dependencies = [ "base64", "eframe", - "egui 0.29.0", - "egui_extras 0.29.0", + "egui", + "egui_extras", "image", "oxhttp", "serde", @@ -1556,7 +1524,7 @@ name = "egui_virtual_list" version = "0.4.0" dependencies = [ "eframe", - "egui 0.29.0", + "egui", "rand 0.8.5", "web-time", ] @@ -1567,8 +1535,8 @@ version = "0.1.0" dependencies = [ "base64", "eframe", - "egui 0.29.0", - "egui_extras 0.29.0", + "egui", + "egui_extras", "egui_inbox", "image", "log", @@ -1600,11 +1568,6 @@ version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" -[[package]] -name = "emath" -version = "0.28.1" -source = "git+https://github.com/emilk/egui?branch=master#06f709481a4e5e74bec961544c77e9afcae265db" - [[package]] name = "emath" version = "0.29.0" @@ -1665,20 +1628,6 @@ dependencies = [ "syn 2.0.68", ] -[[package]] -name = "epaint" -version = "0.28.1" -source = "git+https://github.com/emilk/egui?branch=master#06f709481a4e5e74bec961544c77e9afcae265db" -dependencies = [ - "ab_glyph", - "ahash", - "ecolor 0.28.1", - "emath 0.28.1", - "epaint_default_fonts 0.28.1", - "nohash-hasher", - "parking_lot", -] - [[package]] name = "epaint" version = "0.29.0" @@ -1688,19 +1637,14 @@ dependencies = [ "ab_glyph", "ahash", "bytemuck", - "ecolor 0.29.0", - "emath 0.29.0", - "epaint_default_fonts 0.29.0", + "ecolor", + "emath", + "epaint_default_fonts", "log", "nohash-hasher", "parking_lot", ] -[[package]] -name = "epaint_default_fonts" -version = "0.28.1" -source = "git+https://github.com/emilk/egui?branch=master#06f709481a4e5e74bec961544c77e9afcae265db" - [[package]] name = "epaint_default_fonts" version = "0.29.0" @@ -1790,11 +1734,11 @@ dependencies = [ "casey", "color-hex", "eframe", - "egui 0.29.0", + "egui", "egui_animation", "egui_commonmark", "egui_dnd", - "egui_extras 0.29.0", + "egui_extras", "egui_flex", "egui_form", "egui_inbox", @@ -2638,7 +2582,7 @@ name = "hello_egui_utils" version = "0.5.0" dependencies = [ "concat-idents", - "egui 0.29.0", + "egui", "tokio", "wasm-bindgen-futures", ] @@ -4209,9 +4153,9 @@ dependencies = [ [[package]] name = "pulldown-cmark" -version = "0.11.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8746739f11d39ce5ad5c2520a9b75285310dbfe78c541ccf832d38615765aec0" +checksum = "666f0f59e259aea2d72e6012290c09877a780935cc3c18b1ceded41f3890d59c" dependencies = [ "bitflags 2.6.0", "memchr", @@ -6791,3 +6735,13 @@ dependencies = [ name = "eframe" version = "0.28.1" source = "git+https://github.com/emilk/egui?branch=master#06f709481a4e5e74bec961544c77e9afcae265db" + +[[patch.unused]] +name = "egui" +version = "0.28.1" +source = "git+https://github.com/emilk/egui?branch=master#06f709481a4e5e74bec961544c77e9afcae265db" + +[[patch.unused]] +name = "egui_extras" +version = "0.28.1" +source = "git+https://github.com/emilk/egui?branch=master#06f709481a4e5e74bec961544c77e9afcae265db" diff --git a/crates/egui_flex/examples/flex_customize_example.rs b/crates/egui_flex/examples/flex_customize_example.rs index ac5cee0..9713328 100644 --- a/crates/egui_flex/examples/flex_customize_example.rs +++ b/crates/egui_flex/examples/flex_customize_example.rs @@ -1,6 +1,6 @@ use eframe::NativeOptions; -use egui::{Button, Ui, Window}; -use egui_flex::{Flex, FlexDirection, FlexInstance, FlexItem}; +use egui::{Button, Window}; +use egui_flex::{Flex, FlexInstance, FlexItem}; #[derive(Clone, Debug)] enum ItemKind { diff --git a/crates/egui_flex/examples/flex_example.rs b/crates/egui_flex/examples/flex_example.rs index 430088f..004119f 100644 --- a/crates/egui_flex/examples/flex_example.rs +++ b/crates/egui_flex/examples/flex_example.rs @@ -1,5 +1,5 @@ use eframe::NativeOptions; -use egui::{Button, CentralPanel, Checkbox, Frame, Id, Label, Slider, TextEdit, Widget}; +use egui::{Button, CentralPanel, Checkbox, Frame, Label, Slider, TextEdit, Widget}; use egui_flex::{Flex, FlexAlign, FlexItem}; use std::num::NonZeroUsize; @@ -190,14 +190,14 @@ fn main() -> eframe::Result { // }); ui.horizontal_wrapped(|ui| { - ui.button("Normal Button"); + let _ = ui.button("Normal Button"); Flex::horizontal().show(ui, |flex| { flex.add(FlexItem::new(), Button::new("Hello")); }); - ui.button("Normal Button"); + let _ = ui.button("Normal Button"); }); - ui.button("Button"); + let _ = ui.button("Button"); // Window::new("Window").show(ui.ctx(), |ui| { // Flex::horizontal().show(ui, |flex| { diff --git a/crates/egui_flex/src/lib.rs b/crates/egui_flex/src/lib.rs index ad23869..883cf09 100644 --- a/crates/egui_flex/src/lib.rs +++ b/crates/egui_flex/src/lib.rs @@ -2,8 +2,8 @@ pub mod flex_widget; use crate::flex_widget::FlexWidget; use egui::{ - Align, Align2, Context, Frame, Id, InnerResponse, Layout, Margin, Pos2, Rect, Response, Sense, - Ui, UiBuilder, Vec2, Widget, + Align, Align2, Frame, Id, InnerResponse, Layout, Margin, Pos2, Rect, Response, Sense, Ui, + UiBuilder, Vec2, Widget, }; use std::mem; @@ -199,7 +199,6 @@ impl Flex { let cross_direction = 1 - direction; let rows = self.layout_rows( - ui.ctx(), &previous_state, available_size, gap, @@ -216,17 +215,8 @@ impl Flex { // } let max_item_size = max_item_size.unwrap_or(ui.available_size()); - let min_size_rows = self.layout_rows( - ui.ctx(), - &previous_state, - max_item_size, - gap, - direction, - ui.min_rect().min, - ); let mut instance = FlexInstance { - current_index: 0, current_row: 0, current_row_index: 0, flex: &self, @@ -235,7 +225,7 @@ impl Flex { max_item_size, }, direction, - row_ui: FlexInstance::row_ui(ui, rows.first(), direction), + row_ui: FlexInstance::row_ui(ui, rows.first()), ui, rows, max_item_size, @@ -302,7 +292,6 @@ impl Flex { fn layout_rows( &self, - ctx: &Context, state: &FlexState, available_size: Vec2, gap: Vec2, @@ -364,7 +353,7 @@ impl Flex { let mut row_position = min_position; - for (i, row) in rows.iter_mut().enumerate() { + for row in rows.iter_mut() { let mut row_size = Vec2::ZERO; row_size[direction] = available_length; row_size[cross_direction] = row.cross_size + extra_cross_space_per_row; @@ -427,7 +416,6 @@ struct FlexState { pub struct FlexInstance<'a> { flex: &'a Flex, - current_index: usize, current_row: usize, current_row_index: usize, state: FlexState, @@ -442,11 +430,10 @@ pub struct FlexInstance<'a> { } impl<'a> FlexInstance<'a> { - fn row_ui(parent: &mut Ui, row: Option<&RowData>, direction: usize) -> Ui { - let mut rect = row + fn row_ui(parent: &mut Ui, row: Option<&RowData>) -> Ui { + let rect = row .map(|row| row.rect.unwrap()) .unwrap_or(parent.max_rect()); - let child = parent.new_child(UiBuilder::new().max_rect(rect)); // parent.ctx().debug_painter().debug_rect( // rect, @@ -461,7 +448,7 @@ impl<'a> FlexInstance<'a> { // child.set_width(child.available_width()); // child.set_height(child.available_height()); - child + parent.new_child(UiBuilder::new().max_rect(rect)) } pub fn direction(&self) -> FlexDirection { @@ -620,12 +607,9 @@ impl<'a> FlexInstance<'a> { &mut child_ui, FlexContainerUi { direction: self.direction, - extra_length, - basis: item.basis, content_rect, frame_rect, margin: item_state.margin, - parent_min_rect, max_item_size: max_content_size, // If the available space grows we want to remeasure the widget, in case // it's wrapped so it can un-wrap @@ -652,12 +636,9 @@ impl<'a> FlexInstance<'a> { ui, FlexContainerUi { direction: self.direction, - extra_length: 0.0, - basis: item.basis, content_rect: rect, frame_rect: rect, margin: Margin::ZERO, - parent_min_rect: rect, max_item_size: self.max_item_size, remeasure_widget: false, last_inner_size: None, @@ -701,8 +682,7 @@ impl<'a> FlexInstance<'a> { if self.current_row_index >= row_len { self.current_row += 1; self.current_row_index = 0; - self.row_ui = - FlexInstance::row_ui(self.ui, self.rows.get(self.current_row), self.direction); + self.row_ui = FlexInstance::row_ui(self.ui, self.rows.get(self.current_row)); } InnerResponse::new(inner, res.response) @@ -785,12 +765,9 @@ impl<'a> FlexInstance<'a> { pub struct FlexContainerUi { direction: usize, - basis: Option, - extra_length: f32, content_rect: Rect, frame_rect: Rect, margin: Margin, - parent_min_rect: Rect, max_item_size: Vec2, remeasure_widget: bool, last_inner_size: Option, @@ -825,16 +802,10 @@ impl FlexContainerUi { content: impl FnOnce(&mut Ui) -> R, ) -> FlexContainerResponse { let Self { - direction, - extra_length, - basis, content_rect, frame_rect, margin, - parent_min_rect, - max_item_size, - remeasure_widget: _, - last_inner_size: _, + .. } = self; // We will assume that the margin is symmetrical @@ -885,16 +856,12 @@ impl FlexContainerUi { // format!("frame_rect"), // ); let Self { - direction, - basis, - extra_length, - content_rect, frame_rect, margin, - parent_min_rect, max_item_size, remeasure_widget: _, last_inner_size: _, + .. } = self; // We will assume that the margin is symmetrical @@ -929,7 +896,6 @@ impl FlexContainerUi { widget: impl Widget, ) -> FlexContainerResponse { let margin_top_left = ui.min_rect().min - self.frame_rect.min; - let available_size = ui.available_size(); let response = if self.remeasure_widget { ui.ctx().request_discard("Flex item remeasure"); diff --git a/fancy-example/Cargo.toml b/fancy-example/Cargo.toml index 9abfdc7..6c15c8b 100644 --- a/fancy-example/Cargo.toml +++ b/fancy-example/Cargo.toml @@ -37,7 +37,7 @@ serde_json = "1" casey = "0.4.0" -egui_commonmark = { version = "0.17.0", features = [] } +egui_commonmark = { version = "0.18.0", features = [] } validator = { version = "0.18.1", features = ["derive"] } diff --git a/fancy-example/src/chat.rs b/fancy-example/src/chat.rs index 79ae277..dce7cb1 100644 --- a/fancy-example/src/chat.rs +++ b/fancy-example/src/chat.rs @@ -4,7 +4,8 @@ use std::time::Duration; use eframe::emath::Vec2; use egui::{ - Align, Frame, Label, Layout, Rect, RichText, Rounding, ScrollArea, Shape, Stroke, Ui, Widget, + Align, Frame, Label, Layout, Rect, RichText, Rounding, ScrollArea, Shape, Stroke, Ui, + UiBuilder, Widget, }; use egui_animation::animate_continuous; @@ -211,7 +212,11 @@ impl ChatExample { // chat bubble layout where the own bubbles are right-aligned and // the text within is left-aligned. let (_pos, galley, _response) = label.layout_in_ui( - &mut ui.child_ui(ui.max_rect(), *ui.layout(), None), + &mut ui.new_child( + UiBuilder::new() + .max_rect(ui.max_rect()) + .layout(*ui.layout()), + ), ); let rect = galley.rect; // Calculate the width of the frame based on the width of diff --git a/fancy-example/src/crate_ui.rs b/fancy-example/src/crate_ui.rs index f9238a1..356eda5 100644 --- a/fancy-example/src/crate_ui.rs +++ b/fancy-example/src/crate_ui.rs @@ -1,5 +1,5 @@ use casey::snake; -use egui::{Button, Response, ScrollArea, Ui, Widget}; +use egui::{Button, ScrollArea, Ui, Widget}; use egui_commonmark::{CommonMarkCache, CommonMarkViewer}; use Crate::*; @@ -164,13 +164,13 @@ pub fn crate_usage_ui(ui: &mut Ui, crates: &[CrateUsage], shared_state: &SharedS }); } -pub fn crate_button_ui(ui: &mut Ui, name: &str, selected: bool) -> Response { - ui.scope(|ui| { - ui.spacing_mut().button_padding = egui::vec2(6.0, 4.0); - Button::new(name).selected(selected).rounding(16.0).ui(ui) - }) - .inner -} +// pub fn crate_button_ui(ui: &mut Ui, name: &str, selected: bool) -> Response { +// ui.scope(|ui| { +// ui.spacing_mut().button_padding = egui::vec2(6.0, 4.0); +// Button::new(name).selected(selected).rounding(16.0).ui(ui) +// }) +// .inner +// } #[macro_export] macro_rules! crate_usage { @@ -212,11 +212,7 @@ impl CrateUi { // TODO: Find a better solution or cache string let readme_split = readme_split.replace(" no_run", ""); - CommonMarkViewer::new(item.name()).show( - ui, - &mut self.markdown_cache, - &readme_split, - ); + CommonMarkViewer::new().show(ui, &mut self.markdown_cache, &readme_split); }); }); } From 95f0fdf4f0f8d4af0c5e53d40c123e9647f1a8ea Mon Sep 17 00:00:00 2001 From: Nicolas Date: Thu, 26 Sep 2024 23:41:45 +0200 Subject: [PATCH 11/16] clippy party --- .github/workflows/check.yml | 8 +- Cargo.toml | 26 ++ crates/egui_animation/Cargo.toml | 5 +- crates/egui_animation/examples/animations.rs | 13 +- crates/egui_animation/src/lib.rs | 8 +- crates/egui_dnd/Cargo.toml | 2 + crates/egui_dnd/examples/custom_ui.rs | 7 +- crates/egui_dnd/examples/horizontal.rs | 4 +- crates/egui_dnd/examples/index_as_id.rs | 4 +- crates/egui_dnd/examples/infinite_scroll.rs | 6 +- crates/egui_dnd/examples/simple.rs | 4 +- crates/egui_dnd/examples/sort_words.rs | 8 +- crates/egui_dnd/examples/update_on_drop.rs | 4 +- .../examples/vertical_centered_justified.rs | 4 +- crates/egui_dnd/examples/virtual_list.rs | 14 +- crates/egui_dnd/src/item.rs | 7 +- crates/egui_dnd/src/item_iterator.rs | 14 +- crates/egui_dnd/src/lib.rs | 37 +- crates/egui_dnd/src/state.rs | 117 ++--- crates/egui_flex/Cargo.toml | 5 +- .../examples/flex_customize_example.rs | 6 +- crates/egui_flex/examples/flex_demos.rs | 403 +++++++++--------- crates/egui_flex/examples/flex_example.rs | 11 +- crates/egui_flex/examples/flex_nested.rs | 186 ++++---- .../egui_flex/examples/simple_horizontal.rs | 23 +- crates/egui_flex/src/flex_widget.rs | 7 +- crates/egui_flex/src/lib.rs | 111 +---- crates/egui_form/Cargo.toml | 3 + crates/egui_form/examples/validator.rs | 4 +- crates/egui_form/src/form.rs | 8 +- crates/egui_form/src/form_field.rs | 11 +- crates/egui_form/src/garde.rs | 32 +- crates/egui_form/src/lib.rs | 9 +- crates/egui_form/src/validation_report.rs | 4 +- crates/egui_form/src/validator.rs | 19 +- crates/egui_inbox/Cargo.toml | 10 +- crates/egui_inbox/examples/inbox.rs | 6 +- crates/egui_inbox/examples/inbox_http.rs | 8 +- crates/egui_inbox/examples/stop_async_task.rs | 73 ++-- crates/egui_inbox/examples/without_egui.rs | 2 +- crates/egui_inbox/src/lib.rs | 42 +- crates/egui_inbox/src/type_inbox.rs | 10 +- crates/egui_infinite_scroll/Cargo.toml | 3 + .../examples/infinite_scroll.rs | 6 +- .../infinite_scroll_both_directions.rs | 6 +- .../examples/infinite_scroll_retry.rs | 6 +- crates/egui_infinite_scroll/src/lib.rs | 12 +- crates/egui_pull_to_refresh/Cargo.toml | 3 + .../egui_pull_to_refresh/examples/dad_joke.rs | 4 +- .../examples/pull_refresh_minimal.rs | 6 +- .../examples/pull_refresh_scroll_area.rs | 6 +- crates/egui_pull_to_refresh/src/lib.rs | 10 +- .../src/progress_spinner.rs | 2 +- crates/egui_router/Cargo.toml | 9 +- crates/egui_router/examples/router_minimal.rs | 3 +- crates/egui_router/src/history/memory.rs | 2 +- crates/egui_router/src/history/mod.rs | 6 +- crates/egui_router/src/lib.rs | 16 +- crates/egui_router/src/router.rs | 33 +- crates/egui_router/src/router_builder.rs | 10 +- crates/egui_router/src/transition.rs | 64 +-- crates/egui_suspense/Cargo.toml | 3 + crates/egui_suspense/examples/async.rs | 11 +- .../egui_suspense/examples/customization.rs | 6 +- crates/egui_suspense/examples/suspense.rs | 6 +- .../examples/suspense_minimal.rs | 10 +- crates/egui_suspense/src/lib.rs | 8 +- crates/egui_taffy/Cargo.toml | 2 + crates/egui_taffy/examples/taffy.rs | 13 +- crates/egui_taffy/src/lib.rs | 19 +- crates/egui_thumbhash/Cargo.toml | 16 +- crates/egui_thumbhash/src/image.rs | 15 +- crates/egui_thumbhash/src/lib.rs | 8 +- crates/egui_virtual_list/Cargo.toml | 3 + .../examples/virtual_list.rs | 8 +- crates/egui_virtual_list/src/lib.rs | 34 +- crates/egui_webview/Cargo.toml | 5 +- .../examples/native_text_field.rs | 81 ++-- crates/egui_webview/examples/webview.rs | 52 +-- crates/egui_webview/src/lib.rs | 51 +-- crates/egui_webview/src/native_text_field.rs | 8 +- crates/hello_egui_utils/Cargo.toml | 3 + crates/perfect_cursors/Cargo.toml | 3 + .../examples/perfect_cursors_egui.rs | 6 +- crates/perfect_cursors/src/lib.rs | 14 +- crates/perfect_cursors/src/spline.rs | 6 +- fancy-example/Cargo.toml | 3 + fancy-example/src/chat.rs | 17 +- fancy-example/src/color_sort.rs | 5 +- fancy-example/src/crate_ui.rs | 14 +- fancy-example/src/gallery.rs | 6 +- fancy-example/src/main.rs | 18 +- fancy-example/src/routes.rs | 3 +- fancy-example/src/sidebar.rs | 12 +- fancy-example/src/signup_form.rs | 23 +- 95 files changed, 1026 insertions(+), 958 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 0f8c941..31febeb 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -1,6 +1,6 @@ name: CI -on: [ push ] +on: [push] env: CARGO_TERM_COLOR: always @@ -11,10 +11,10 @@ jobs: tests: strategy: matrix: - os: [ ubuntu-latest, macos-latest, windows-latest ] + os: [ubuntu-latest, macos-latest, windows-latest] runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up cargo cache uses: Swatinem/rust-cache@v2 @@ -47,7 +47,7 @@ jobs: miri: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install Miri uses: actions-rs/toolchain@v1 diff --git a/Cargo.toml b/Cargo.toml index 365b34e..a8734c9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -86,6 +86,32 @@ egui = { version = "0.29.0", default-features = false } eframe = { version = "0.29.0", default-features = false } egui_extras = { version = "0.29.0", default-features = false } +[workspace.lints.rust] +unsafe_code = "deny" + +[workspace.lints.clippy] +pedantic = { level = "deny", priority = 1 } +enum_glob_use = { level = "deny", priority = 2 } +module_name_repetitions = { level = "allow", priority = 3 } +cast_precision_loss = { level = "allow", priority = 4 } +cast_possible_truncation = { level = "allow", priority = 5 } +cast_sign_loss = { level = "allow", priority = 6 } +out_of_bounds_indexing = { level = "allow", priority = 7 } +perf = { level = "warn", priority = 8 } +style = { level = "warn", priority = 9 } +# TODO: Uncomment/Deny the following lines when the clippy lints are fixed +#unwrap_used = { level = "deny", priority = 10 } +#expect_used = { level = "deny", priority = 11 } +# needless_doctest_main = { level = "allow", priority = 12 } +# implicit_hasher = { level = "allow", priority = 13 } +float_cmp = { level = "allow", priority = 14 } +struct_excessive_bools = { level = "allow", priority = 15 } +must_use_candidate = { level = "allow", priority = 16 } +return_self_not_must_use = { level = "allow", priority = 17 } +missing_panics_doc = { level = "allow", priority = 18 } +missing_errors_doc = { level = "allow", priority = 19 } +missing_fields_in_debug = { level = "allow", priority = 20 } + [patch.crates-io] #wry = { path = "../../RustroverProjects/github/wry" } # diff --git a/crates/egui_animation/Cargo.toml b/crates/egui_animation/Cargo.toml index 414bf6d..ede383c 100644 --- a/crates/egui_animation/Cargo.toml +++ b/crates/egui_animation/Cargo.toml @@ -17,5 +17,8 @@ egui.workspace = true simple-easing = "1" [dev-dependencies] -eframe = { workspace = true, default-features = true} +eframe = { workspace = true, default-features = true } rand = "0.8.5" + +[lints] +workspace = true diff --git a/crates/egui_animation/examples/animations.rs b/crates/egui_animation/examples/animations.rs index 483897e..1f1134c 100644 --- a/crates/egui_animation/examples/animations.rs +++ b/crates/egui_animation/examples/animations.rs @@ -1,5 +1,5 @@ -use eframe::egui; use eframe::emath::Align; +use eframe::{egui, NativeOptions}; use egui::{CentralPanel, ComboBox, Layout, ScrollArea, Vec2}; use egui_animation::{animate_ui_translation, Collapse}; use hello_egui_utils::measure_text; @@ -40,6 +40,7 @@ const EASINGS: [(fn(f32) -> f32, &str); 31] = [ (simple_easing::expo_out, "Exponential out"), ]; +#[allow(clippy::too_many_lines)] // It's ok for an example. pub fn main() -> eframe::Result<()> { let mut target = 0.0; @@ -57,7 +58,7 @@ pub fn main() -> eframe::Result<()> { eframe::run_simple_native( "DnD Simple Example", - Default::default(), + NativeOptions::default(), move |ctx, _frame| { CentralPanel::default().show(ctx, |ui| { ui.horizontal_wrapped(|ui| { @@ -71,9 +72,9 @@ pub fn main() -> eframe::Result<()> { ) .width(200.0) .show_ui(ui, |ui| { - EASINGS.iter().for_each(|(easing_fn, name)| { + for (easing_fn, name) in &EASINGS { ui.selectable_value(&mut easing, *easing_fn, *name); - }); + } }); }); @@ -146,7 +147,7 @@ pub fn main() -> eframe::Result<()> { let size = measure_text(ui, text) + Vec2::new(4.0, 0.0); ui.allocate_ui(size, |ui| { - words.iter().for_each(|(id, text)| { + for (id, text) in &words { let size = measure_text(ui, **text); animate_ui_translation( ui, @@ -158,7 +159,7 @@ pub fn main() -> eframe::Result<()> { ui.label(**text); }, ); - }); + } }); words = vec![]; } else { diff --git a/crates/egui_animation/src/lib.rs b/crates/egui_animation/src/lib.rs index 3099b58..27134a4 100644 --- a/crates/egui_animation/src/lib.rs +++ b/crates/egui_animation/src/lib.rs @@ -25,7 +25,7 @@ struct AnimationState { type Easing = fn(f32) -> f32; -/// Same as [Context::animate_bool_with_time] but with an easing function. +/// Same as [`Context::animate_bool_with_time`] but with an easing function. pub fn animate_bool_eased( ctx: &Context, id: impl Hash + Sized, @@ -37,7 +37,7 @@ pub fn animate_bool_eased( easing(x) } -/// Same as [Context::animate_value_with_time] but with an easing function. +/// Same as [`Context::animate_value_with_time`] but with an easing function. pub fn animate_eased( ctx: &Context, id: impl Hash + Sized, @@ -71,7 +71,7 @@ pub fn animate_eased( } /// Animate a position. Useful to e.g. animate swapping items in a list. -/// This is basically a wrapper around [animate_eased] that animates both x and y. +/// This is basically a wrapper around [`animate_eased`] that animates both x and y. /// It will try to correct for scrolling, since in egui, scroll will change a widgets y position. pub fn animate_position( ui: &mut Ui, @@ -99,7 +99,7 @@ pub fn animate_position( position - scroll_offset } -/// A wrapper around [animate_position] that animates the position of a child ui. +/// A wrapper around [`animate_position`] that animates the position of a child ui. pub fn animate_ui_translation( ui: &mut Ui, id: impl Hash + Sized + Debug + Copy, diff --git a/crates/egui_dnd/Cargo.toml b/crates/egui_dnd/Cargo.toml index d13b9e3..c98b0a7 100644 --- a/crates/egui_dnd/Cargo.toml +++ b/crates/egui_dnd/Cargo.toml @@ -31,3 +31,5 @@ color-hex = "0.2.0" egui = { workspace = true, features = ["color-hex"] } eframe = { workspace = true, default-features = true } +[lints] +workspace = true diff --git a/crates/egui_dnd/examples/custom_ui.rs b/crates/egui_dnd/examples/custom_ui.rs index 280c121..c79ed77 100644 --- a/crates/egui_dnd/examples/custom_ui.rs +++ b/crates/egui_dnd/examples/custom_ui.rs @@ -1,4 +1,4 @@ -use eframe::egui; +use eframe::{egui, NativeOptions}; use egui::{CentralPanel, Frame, Stroke, Ui}; use egui_dnd::{dnd, DragDropItem}; @@ -8,7 +8,7 @@ pub fn main() -> eframe::Result<()> { eframe::run_simple_native( "DnD Simple Example", - Default::default(), + NativeOptions::default(), move |ctx, _frame| { CentralPanel::default().show(ctx, |ui| { ui.label("Drag and drop the items below"); @@ -20,8 +20,7 @@ pub fn main() -> eframe::Result<()> { .stroke(Stroke::new(1.0, egui::Color32::from_rgb(0, 0, 0))) .show(ui, |ui| { ui.set_min_size(space); - }) - .inner + }); }; iter.space_before(ui, item.id(), space_content); diff --git a/crates/egui_dnd/examples/horizontal.rs b/crates/egui_dnd/examples/horizontal.rs index 17e00d6..faab755 100644 --- a/crates/egui_dnd/examples/horizontal.rs +++ b/crates/egui_dnd/examples/horizontal.rs @@ -1,4 +1,4 @@ -use eframe::egui; +use eframe::{egui, NativeOptions}; use egui::{CentralPanel, Frame, Label, ScrollArea, TopBottomPanel, Ui, Vec2, Widget}; use egui_dnd::dnd; @@ -10,7 +10,7 @@ pub fn main() -> eframe::Result<()> { eframe::run_simple_native( "DnD Simple Example", - Default::default(), + NativeOptions::default(), move |ctx, _frame| { TopBottomPanel::bottom("bottom_panel").show(ctx, |ui| { ui.horizontal(|ui| { diff --git a/crates/egui_dnd/examples/index_as_id.rs b/crates/egui_dnd/examples/index_as_id.rs index 2dcb3bc..979e9c8 100644 --- a/crates/egui_dnd/examples/index_as_id.rs +++ b/crates/egui_dnd/examples/index_as_id.rs @@ -1,4 +1,4 @@ -use eframe::egui; +use eframe::{egui, NativeOptions}; use egui::{CentralPanel, Id}; use egui_dnd::{dnd, DragDropItem}; @@ -37,7 +37,7 @@ pub fn main() -> eframe::Result<()> { eframe::run_simple_native( "DnD Simple Example", - Default::default(), + NativeOptions::default(), move |ctx, _frame| { CentralPanel::default().show(ctx, |ui| { let response = dnd(ui, "dnd_example") diff --git a/crates/egui_dnd/examples/infinite_scroll.rs b/crates/egui_dnd/examples/infinite_scroll.rs index 27877db..fd3054c 100644 --- a/crates/egui_dnd/examples/infinite_scroll.rs +++ b/crates/egui_dnd/examples/infinite_scroll.rs @@ -1,4 +1,4 @@ -use eframe::egui; +use eframe::{egui, NativeOptions}; use egui::{CentralPanel, Id, ScrollArea}; use egui_dnd::dnd; use egui_infinite_scroll::InfiniteScroll; @@ -12,7 +12,7 @@ pub fn main() -> eframe::Result<()> { eframe::run_simple_native( "DnD Infinite Scroll Example", - Default::default(), + NativeOptions::default(), move |ctx, _frame| { CentralPanel::default().show(ctx, |ui| { ScrollArea::vertical().show(ui, |ui| { @@ -28,7 +28,7 @@ pub fn main() -> eframe::Result<()> { ui.label("drag"); } }); - ui.label(format!("Item {}", item)); + ui.label(format!("Item {item}")); }); }) }); diff --git a/crates/egui_dnd/examples/simple.rs b/crates/egui_dnd/examples/simple.rs index af92e9e..4a312a2 100644 --- a/crates/egui_dnd/examples/simple.rs +++ b/crates/egui_dnd/examples/simple.rs @@ -1,4 +1,4 @@ -use eframe::egui; +use eframe::{egui, NativeOptions}; use egui::CentralPanel; use egui_dnd::dnd; @@ -7,7 +7,7 @@ pub fn main() -> eframe::Result<()> { eframe::run_simple_native( "DnD Simple Example", - Default::default(), + NativeOptions::default(), move |ctx, _frame| { CentralPanel::default().show(ctx, |ui| { dnd(ui, "dnd_example").show_vec(&mut items, |ui, item, handle, state| { diff --git a/crates/egui_dnd/examples/sort_words.rs b/crates/egui_dnd/examples/sort_words.rs index a7a346b..4b31732 100644 --- a/crates/egui_dnd/examples/sort_words.rs +++ b/crates/egui_dnd/examples/sort_words.rs @@ -1,5 +1,5 @@ // This example shows how to sort items in a horizontal_wrapped layout where each item has a different size. -use eframe::egui; +use eframe::{egui, NativeOptions}; use egui::{CentralPanel, Frame, Id, ScrollArea, Ui, Vec2}; use egui_dnd::dnd; @@ -32,7 +32,7 @@ pub fn dnd_ui(ui: &mut Ui, items: &mut [(usize, String)]) { }); } -const TEXT: &str = r#" +const TEXT: &str = r" Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. @@ -46,7 +46,7 @@ Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie co At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, At accusam aliquyam diam diam dolore dolores duo eirmod eos erat, et nonumy sed tempor et et invidunt justo labore Stet clita ea et gubergren, kasd magna no rebum. sanctus sea sed takimata ut vero voluptua. est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat. Consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus. -"#; +"; pub fn main() -> eframe::Result<()> { let mut items = TEXT @@ -59,7 +59,7 @@ pub fn main() -> eframe::Result<()> { eframe::run_simple_native( "DnD Simple Example", - Default::default(), + NativeOptions::default(), move |ctx, _frame| { CentralPanel::default() .frame(Frame::none().inner_margin(8.0).fill( diff --git a/crates/egui_dnd/examples/update_on_drop.rs b/crates/egui_dnd/examples/update_on_drop.rs index d3e5889..dd10004 100644 --- a/crates/egui_dnd/examples/update_on_drop.rs +++ b/crates/egui_dnd/examples/update_on_drop.rs @@ -1,4 +1,4 @@ -use eframe::egui; +use eframe::{egui, NativeOptions}; use egui::CentralPanel; use egui_dnd::dnd; @@ -7,7 +7,7 @@ pub fn main() -> eframe::Result<()> { eframe::run_simple_native( "DnD Simple Example", - Default::default(), + NativeOptions::default(), move |ctx, _frame| { CentralPanel::default().show(ctx, |ui| { ui.label("Drag and drop the items below"); diff --git a/crates/egui_dnd/examples/vertical_centered_justified.rs b/crates/egui_dnd/examples/vertical_centered_justified.rs index d69afc4..6229c5e 100644 --- a/crates/egui_dnd/examples/vertical_centered_justified.rs +++ b/crates/egui_dnd/examples/vertical_centered_justified.rs @@ -1,4 +1,4 @@ -use eframe::egui; +use eframe::{egui, NativeOptions}; use egui::{Button, CentralPanel, Widget}; use egui_dnd::dnd; @@ -7,7 +7,7 @@ pub fn main() -> eframe::Result<()> { eframe::run_simple_native( "DnD Simple Example", - Default::default(), + NativeOptions::default(), move |ctx, _frame| { CentralPanel::default().show(ctx, |ui| { ui.vertical_centered_justified(|ui| { diff --git a/crates/egui_dnd/examples/virtual_list.rs b/crates/egui_dnd/examples/virtual_list.rs index 70965b1..bf60f3c 100644 --- a/crates/egui_dnd/examples/virtual_list.rs +++ b/crates/egui_dnd/examples/virtual_list.rs @@ -1,5 +1,5 @@ -use eframe::egui; use eframe::epaint::Margin; +use eframe::{egui, NativeOptions}; use egui::{CentralPanel, Frame, Id, ScrollArea}; use egui_dnd::dnd; use egui_virtual_list::VirtualList; @@ -7,12 +7,12 @@ use rand::prelude::StdRng; use rand::{Rng, SeedableRng}; pub fn main() -> eframe::Result<()> { - let mut items: Vec<_> = (0..100000).collect(); + let mut items: Vec<_> = (0..100_000).collect(); let mut virtual_list = VirtualList::new(); eframe::run_simple_native( "DnD Virtual List Example", - Default::default(), + NativeOptions::default(), move |ctx, _frame| { CentralPanel::default().show(ctx, |ui| { ScrollArea::vertical().show(ui, |ui| { @@ -27,7 +27,7 @@ pub fn main() -> eframe::Result<()> { true, |ui, dnd_item| { dnd_item.ui(ui, |ui, handle, _item_state| { - draw_item(ui, handle, item); + draw_item(ui, handle, *item); }) }, ); @@ -47,10 +47,10 @@ pub fn main() -> eframe::Result<()> { ) } -fn draw_item(ui: &mut egui::Ui, handle: egui_dnd::Handle, item: &i32) { +fn draw_item(ui: &mut egui::Ui, handle: egui_dnd::Handle, item: i32) { // For the sake of the example we generate a random height based on the item index // but if your row height e.g. depends on some text with varying rows this would also work. - let mut rng = StdRng::seed_from_u64(*item as u64); + let mut rng = StdRng::seed_from_u64(item as u64); let height = rng.gen_range(0.0..=100.0); Frame::canvas(ui.style()) @@ -58,7 +58,7 @@ fn draw_item(ui: &mut egui::Ui, handle: egui_dnd::Handle, item: &i32) { .show(ui, |ui| { ui.set_width(ui.available_width()); handle.ui(ui, |ui| { - ui.label(format!("Item {}", item)); + ui.label(format!("Item {item}")); }); }); } diff --git a/crates/egui_dnd/src/item.rs b/crates/egui_dnd/src/item.rs index 61d0bdc..5aea6b4 100644 --- a/crates/egui_dnd/src/item.rs +++ b/crates/egui_dnd/src/item.rs @@ -47,6 +47,7 @@ impl<'a> Item<'a> { self.drag_source(Some(size), ui, add_content) } + #[allow(clippy::too_many_lines)] // TODO: refactor this to reduce the number of lines fn drag_source( self, size: Option, @@ -190,7 +191,7 @@ impl<'a> Item<'a> { rect.min, ), self.state, - ) + ); }, ); @@ -233,7 +234,7 @@ impl<'a> Item<'a> { animated_position, ), self.state, - ) + ); }, ); @@ -278,7 +279,7 @@ impl<'a> Item<'a> { ui, Handle::new(id, state.index, dnd_state, hovering_over_any_handle, pos), state, - ) + ); }) .response .rect diff --git a/crates/egui_dnd/src/item_iterator.rs b/crates/egui_dnd/src/item_iterator.rs index 517cc63..fa615fc 100644 --- a/crates/egui_dnd/src/item_iterator.rs +++ b/crates/egui_dnd/src/item_iterator.rs @@ -4,7 +4,7 @@ use crate::{DragDropUi, ItemState}; use egui::{Id, Layout, Pos2, Rect, Ui, UiBuilder, Vec2}; /// Calculates some information that is later used to detect in which index the dragged item should be placed. -/// [ItemIterator::next] should be called for each item in the list. +/// [`ItemIterator::next`] should be called for each item in the list. pub struct ItemIterator<'a> { state: &'a mut DragDropUi, dragged_item_rect: Option, @@ -66,7 +66,7 @@ impl<'a> ItemIterator<'a> { /// Draw a dnd item. This should be called for each item in the list. /// /// If `add_surrounding_space_automatically` is false, you need to call - /// [ItemIterator::space_before] and [ItemIterator::space_after] manually. + /// [`ItemIterator::space_before`] and [`ItemIterator::space_after`] manually. /// This is useful, e.g. to add a divider between items. Check the custom ui example. pub fn next( &mut self, @@ -94,7 +94,7 @@ impl<'a> ItemIterator<'a> { } if add_surrounding_space_automatically { - self.space_before(ui, id, |_ui, _space| {}) + self.space_before(ui, id, |_ui, _space| {}); } let dragging = self.state.detection_state.is_dragging(); @@ -136,7 +136,7 @@ impl<'a> ItemIterator<'a> { } if add_surrounding_space_automatically { - self.space_after(ui, id, |_ui, _space| {}) + self.space_after(ui, id, |_ui, _space| {}); } if let Some(dragged_item_rect) = self.dragged_item_rect { @@ -225,10 +225,10 @@ impl<'a> ItemIterator<'a> { mark_next: bool, ) { if self.closest_item.is_none() || distance < self.closest_item.unwrap().0 { - if !mark_next { - self.closest_item = Some((distance, item.map(|(idx, id)| (idx, id, pos)))); - } else { + if mark_next { self.mark_next_as_closest_item = Some((distance, pos)); + } else { + self.closest_item = Some((distance, item.map(|(idx, id)| (idx, id, pos)))); } } } diff --git a/crates/egui_dnd/src/lib.rs b/crates/egui_dnd/src/lib.rs index 36a2b49..83caa14 100644 --- a/crates/egui_dnd/src/lib.rs +++ b/crates/egui_dnd/src/lib.rs @@ -24,8 +24,8 @@ pub struct Dnd<'a> { /// Main entry point for the drag and drop functionality. /// Loads and saves it's state from egui memory. -/// Use either [Dnd::show] or [Dnd::show_vec] to display the drag and drop UI. -/// You can use [Dnd::with_mouse_config] or [Dnd::with_touch_config] to configure the drag detection. +/// Use either [`Dnd::show`] or [`Dnd::show_vec`] to display the drag and drop UI. +/// You can use [`Dnd::with_mouse_config`] or [`Dnd::with_touch_config`] to configure the drag detection. /// Example usage: /// ```rust no_run /// use std::hash::Hash; @@ -73,6 +73,7 @@ impl<'a> Dnd<'a> { } /// Sets the config used when dragging with the mouse or when no touch config is set + #[must_use] pub fn with_mouse_config(mut self, config: DragDropConfig) -> Self { self.drag_drop_ui = self.drag_drop_ui.with_mouse_config(config); self @@ -80,9 +81,10 @@ impl<'a> Dnd<'a> { /// Sets the config used when dragging with touch /// If None, the mouse config is used instead - /// Use [DragDropConfig::touch] or [DragDropConfig::touch_scroll] to get a config optimized for touch - /// The default is [DragDropConfig::touch] - /// For dragging in a ScrollArea, use [DragDropConfig::touch_scroll] + /// Use [`DragDropConfig::touch`] or [`DragDropConfig::touch_scroll`] to get a config optimized for touch + /// The default is [`DragDropConfig::touch`] + /// For dragging in a `ScrollArea`, use [`DragDropConfig::touch_scroll`] + #[must_use] pub fn with_touch_config(mut self, config: Option) -> Self { self.drag_drop_ui = self.drag_drop_ui.with_touch_config(config); self @@ -91,6 +93,7 @@ impl<'a> Dnd<'a> { /// Sets the animation time for the return animation (after dropping an item) /// The default is the same as the egui animation time /// If you want to disable the animation, set it to 0 + #[must_use] pub fn with_return_animation_time(mut self, animation_time: f32) -> Self { self.drag_drop_ui.return_animation_time = animation_time; self @@ -99,6 +102,7 @@ impl<'a> Dnd<'a> { /// Sets the animation time for the swap animation (when dragging an item over another item) /// The default is the same as the egui animation time /// If you want to disable the animation, set it to 0 + #[must_use] pub fn with_swap_animation_time(mut self, animation_time: f32) -> Self { self.drag_drop_ui.swap_animation_time = animation_time; self @@ -107,6 +111,7 @@ impl<'a> Dnd<'a> { /// Sets the animation time for all animations /// The default is the same as the egui animation time /// If you want to disable all animations, set it to 0 + #[must_use] pub fn with_animation_time(mut self, animation_time: f32) -> Self { self.drag_drop_ui.return_animation_time = animation_time; self.drag_drop_ui.swap_animation_time = animation_time; @@ -115,13 +120,13 @@ impl<'a> Dnd<'a> { /// Display the drag and drop UI. /// `items` should be an iterator over items that should be sortable. - /// Each item needs to implement [DragDropItem]. This is automatically implement for every type that implements [Hash]. + /// Each item needs to implement [`DragDropItem`]. This is automatically implement for every type that implements [Hash]. /// /// It can also be implemented manually. **Each item needs to have a unique id.** /// If you need to allow duplicate items in your list and cannot add a id field for some reason, /// you can use the index as a id, but there are some limitations. Check the [index_as_id](https://github.com/lucasmerlin/hello_egui/blob/main/crates/egui_dnd/examples/index_as_id.rs) example. /// - /// The items won't be updated automatically, but you can use [Dnd::show_vec] or [DragDropResponse::update_vec] to do so. + /// The items won't be updated automatically, but you can use [`Dnd::show_vec`] or [`DragDropResponse::update_vec`] to do so. /// If your items aren't in a vec, you have to update the order yourself. /// /// `item_ui` is called for each item. Display your item there. @@ -143,11 +148,11 @@ impl<'a> Dnd<'a> { }) } - /// Same as [Dnd::show], but with a fixed size for each item. - /// This allows items to be placed in a horizontal_wrapped ui. + /// Same as [`Dnd::show`], but with a fixed size for each item. + /// This allows items to be placed in a `horizontal_wrapped` ui. /// For more info, look at the [horizontal example](https://github.com/lucasmerlin/hello_egui/blob/main/crates/egui_dnd/examples/horizontal.rs). - /// If you need even more control over the size, use [Dnd::show_custom] instead, where you - /// can individually size each item. See the sort_words example for an example. + /// If you need even more control over the size, use [`Dnd::show_custom`] instead, where you + /// can individually size each item. See the `sort_words` example for an example. pub fn show_sized( self, items: impl Iterator, @@ -159,7 +164,7 @@ impl<'a> Dnd<'a> { items.enumerate().for_each(|(i, item)| { iter.next(ui, item.id(), i, true, |ui, item_handle| { item_handle.ui_sized(ui, size, |ui, handle, state| { - item_ui(ui, item, handle, state) + item_ui(ui, item, handle, state); }) }); }); @@ -167,7 +172,7 @@ impl<'a> Dnd<'a> { }) } - /// Same as [Dnd::show], but automatically sorts the items. + /// Same as [`Dnd::show`], but automatically sorts the items. pub fn show_vec( self, items: &mut [T], @@ -178,7 +183,7 @@ impl<'a> Dnd<'a> { response } - /// Same as [Dnd::show_sized], but automatically sorts the items. + /// Same as [`Dnd::show_sized`], but automatically sorts the items. pub fn show_vec_sized( self, items: &mut [T], @@ -196,7 +201,7 @@ impl<'a> Dnd<'a> { self._show_with_inner(|_id, ui, drag_drop_ui| drag_drop_ui.ui(ui, f)) } - /// Same as [Dnd::show_custom], but automatically sorts the items. + /// Same as [`Dnd::show_custom`], but automatically sorts the items. pub fn show_custom_vec( self, items: &mut [T], @@ -231,7 +236,7 @@ pub struct ItemState { pub dragged: bool, /// Index of the item in the list. /// Note that when you sort the source list while the drag is still ongoing (default behaviour - /// of [Dnd::show_vec]), this index will updated while the item is being dragged. + /// of [`Dnd::show_vec`]), this index will updated while the item is being dragged. /// If you sort once after the item is dropped, the index will be stable during the drag. pub index: usize, } diff --git a/crates/egui_dnd/src/state.rs b/crates/egui_dnd/src/state.rs index 9115d98..c50f395 100644 --- a/crates/egui_dnd/src/state.rs +++ b/crates/egui_dnd/src/state.rs @@ -24,7 +24,7 @@ impl DragDropItem for T { /// An instruction in what order to update the source list. /// The item at from should be removed from the list and inserted at to. -/// You can use [shift_vec] to do this for a Vec. +/// You can use [`shift_vec`] to do this for a Vec. #[derive(Debug, Clone)] pub struct DragUpdate { /// Index of the item to move @@ -34,13 +34,13 @@ pub struct DragUpdate { } /// Response containing state of the drag & drop list and a potential update to the source list. -/// The update can be applied immediately or at latest when [DragDropResponse::is_drag_finished] returns true. +/// The update can be applied immediately or at latest when [`DragDropResponse::is_drag_finished`] returns true. #[derive(Debug, Clone)] pub struct DragDropResponse { state: DragDetectionState, /// Contains ongoing information about which index is currently being dragged where. /// You can use this to consistently update the source list while the drag & drop event is ongoing. - /// If you only want to update the source list when the drag & drop event has finished, use [DragDropResponse::final_update] instead. + /// If you only want to update the source list when the drag & drop event has finished, use [`DragDropResponse::final_update`] instead. pub update: Option, finished: bool, cancellation_reason: Option<&'static str>, @@ -49,22 +49,26 @@ pub struct DragDropResponse { impl DragDropResponse { /// Returns true if we are currently evaluating whether a drag should be started. + #[must_use] pub fn is_evaluating_drag(&self) -> bool { self.state.is_evaluating_drag() } /// Returns true if we are currently dragging an item. + #[must_use] pub fn is_dragging(&self) -> bool { self.state.is_dragging() } /// Returns the id of the item that is currently being dragged. + #[must_use] pub fn dragged_item_id(&self) -> Option { self.state.dragged_item() } /// Returns true if the drag & drop event has finished and the item has been dropped. /// The update should be applied to the source list. + #[must_use] pub fn is_drag_finished(&self) -> bool { self.finished } @@ -81,6 +85,7 @@ impl DragDropResponse { /// Returns the update if the drag & drop event has finished and the item has been dropped. /// Useful for the if let syntax. + #[must_use] pub fn final_update(&self) -> Option { if self.finished { self.update.clone() @@ -90,13 +95,14 @@ impl DragDropResponse { } /// Returns a [Option<&str>] with the reason if a drag & drop event was cancelled. + #[must_use] pub fn cancellation_reason(&self) -> Option<&'static str> { self.cancellation_reason } } /// Holds the data needed to draw the floating item while it is being dragged -/// Deprecated: Use [crate::dnd] or [crate::Dnd::new] instead +/// Deprecated: Use [`crate::dnd`] or [`crate::Dnd::new`] instead #[derive(Clone, Debug)] pub struct DragDropUi { pub(crate) detection_state: DragDetectionState, @@ -119,7 +125,7 @@ impl Default for DragDropUi { } } -/// [Handle::ui] is used to draw the drag handle +/// [`Handle::ui`] is used to draw the drag handle pub struct Handle<'a> { id: Id, idx: usize, @@ -187,12 +193,12 @@ impl DragDetectionState { pub(crate) fn dragged_item_size(&self) -> Option { match self { - DragDetectionState::Dragging { - dragged_item_size, .. - } => Some(*dragged_item_size), DragDetectionState::TransitioningBackAfterDragFinished { dragged_item_size: Some(dragged_item_size), .. + } + | DragDetectionState::Dragging { + dragged_item_size, .. } => Some(*dragged_item_size), _ => None, } @@ -229,10 +235,11 @@ impl<'a> Handle<'a> { } } - /// You can add [Sense::click] if you want to listen for clicks on the handle + /// You can add [`Sense::click`] if you want to listen for clicks on the handle /// **Warning**: This will make anything sensing clicks in the handle not draggable /// Make sure to not set this if your handle consists of a single button, and directly /// query the button for clicks. + #[must_use] pub fn sense(mut self, sense: Sense) -> Self { self.sense = Some(sense); self @@ -240,6 +247,7 @@ impl<'a> Handle<'a> { /// If `true`, the cursor will change to a grab cursor when hovering over the handle /// This is `true` by default + #[must_use] pub fn show_drag_cursor_on_hover(mut self, show: bool) -> Self { self.show_drag_cursor_on_hover = show; self @@ -248,13 +256,14 @@ impl<'a> Handle<'a> { /// By default, selectable labels are disabled in the handle, to not interfere with dragging. /// You can use this to re-enable them. /// Note that if you disable selectable labels globally, this won't have any effect. + #[must_use] pub fn enable_selectable_labels(mut self) -> Self { self.disable_selectable_labels = false; self } - /// Draw the drag handle. Use [Handle::sense] to add a click sense. - /// You can also add buttons in the handle, but they won't be interactive if you pass Sense::click + /// Draw the drag handle. Use [`Handle::sense`] to add a click sense. + /// You can also add buttons in the handle, but they won't be interactive if you pass `Sense::click` pub fn ui(mut self, ui: &mut Ui, contents: impl FnOnce(&mut Ui)) -> egui::Response { let disabled = if self.disable_selectable_labels { let interaction = &mut ui.style_mut().interaction; @@ -279,7 +288,7 @@ impl<'a> Handle<'a> { self.handle_response(response.response, ui) } - /// This is useful if you want to sort items in a horizontal_wrapped. + /// This is useful if you want to sort items in a `horizontal_wrapped`. /// This doesn't create a new scope. pub fn ui_sized( mut self, @@ -357,7 +366,7 @@ impl<'a> Handle<'a> { id: self.id, offset, // We set this in the Item - dragged_item_size: Default::default(), + dragged_item_size: Vec2::default(), closest_item: (self.id, self.item_pos), source_idx: self.idx, hovering_idx: self.idx, @@ -380,14 +389,14 @@ pub struct DragDropConfig { /// How long does the user have to keep pressing until a drag may begin? /// This is useful when dragging and dropping on a touch screen in a scrollable area. pub drag_delay: Duration, - /// How far can the pointer move during the [DragDropConfig::drag_delay] before the drag is cancelled? + /// How far can the pointer move during the [`DragDropConfig::drag_delay`] before the drag is cancelled? pub scroll_tolerance: Option, /// How far does the pointer have to move before a drag starts? /// This is useful when the handle is also a button. /// If the pointer is released before this threshold, the drag never starts and the button / handle can be clicked. - /// If you want to detect clicks on the handle itself, [Handle::sense] to add a click sense to the handle. + /// If you want to detect clicks on the handle itself, [`Handle::sense`] to add a click sense to the handle. pub click_tolerance: f32, - /// If we have been holding longer than this duration, a drag will be started even if the pointer has not moved above [DragDropConfig::click_tolerance]. + /// If we have been holding longer than this duration, a drag will be started even if the pointer has not moved above [`DragDropConfig::click_tolerance`]. pub click_tolerance_timeout: Duration, } @@ -399,6 +408,7 @@ impl Default for DragDropConfig { impl DragDropConfig { /// Optimized for mouse usage + #[must_use] pub fn mouse() -> Self { Self { click_tolerance: 1.0, @@ -409,7 +419,8 @@ impl DragDropConfig { } /// Optimized for touch usage in a fixed size area (no scrolling) - /// Has a higher click tolerance than [DragDropConfig::mouse] + /// Has a higher click tolerance than [`DragDropConfig::mouse`] + #[must_use] pub fn touch() -> Self { Self { scroll_tolerance: None, @@ -420,6 +431,7 @@ impl DragDropConfig { } /// Optimized for touch usage in a scrollable area + #[must_use] pub fn touch_scroll() -> Self { Self { scroll_tolerance: Some(6.0), @@ -430,7 +442,7 @@ impl DragDropConfig { } } -/// [DragDropUi] stores the state of the Drag & Drop list. +/// [`DragDropUi`] stores the state of the Drag & Drop list. impl DragDropUi { /// Sets the config used when dragging with the mouse or when no touch config is set pub fn with_mouse_config(mut self, config: DragDropConfig) -> Self { @@ -440,16 +452,16 @@ impl DragDropUi { /// Sets the config used when dragging with touch /// If None, the mouse config is used instead - /// Use [DragDropConfig::touch] or [DragDropConfig::touch_scroll] to get a config optimized for touch - /// The default is [DragDropConfig::touch] - /// For dragging in a ScrollArea, use [DragDropConfig::touch_scroll] + /// Use [`DragDropConfig::touch`] or [`DragDropConfig::touch_scroll`] to get a config optimized for touch + /// The default is [`DragDropConfig::touch`] + /// For dragging in a `ScrollArea`, use [`DragDropConfig::touch_scroll`] pub fn with_touch_config(mut self, config: Option) -> Self { self.touch_config = config; self } fn config(&self, ui: &Ui) -> &DragDropConfig { - if ui.input(|i| i.any_touches()) { + if ui.input(egui::InputState::any_touches) { self.touch_config.as_ref().unwrap_or(&self.mouse_config) } else { &self.mouse_config @@ -457,6 +469,7 @@ impl DragDropUi { } /// Draw the items and handle drag & drop stuff + #[allow(clippy::too_many_lines)] // TODO: refactor this to reduce the number of lines pub fn ui( &mut self, ui: &mut Ui, @@ -556,7 +569,7 @@ impl DragDropUi { }; let pointer_released = ui.input(|i| i.pointer.any_released()); - let should_update = closest_item.map(|i| i.1.is_some()).unwrap_or(false); + let should_update = closest_item.is_some_and(|i| i.1.is_some()); // The cursor is not hovering over any item, so cancel if first_frame && !hovering_over_any_handle { @@ -597,36 +610,34 @@ impl DragDropUi { } } - let mut response = if !drag_phase_changed_this_frame { - if let DragDetectionState::Dragging { - source_idx, - hovering_idx, - hovering_last_item, - .. - } = self.detection_state - { - DragDropResponse { - finished: false, - update: Some(DragUpdate { - from: source_idx, - to: if hovering_last_item { - hovering_idx + 1 - } else { - hovering_idx - }, - }), - state: self.detection_state.clone(), - cancellation_reason: None, - has_changed: should_update, - } - } else { - DragDropResponse { - finished: false, - update: None, - state: self.detection_state.clone(), - cancellation_reason: None, - has_changed: false, - } + let mut response = if drag_phase_changed_this_frame { + DragDropResponse { + finished: false, + update: None, + state: self.detection_state.clone(), + cancellation_reason: None, + has_changed: false, + } + } else if let DragDetectionState::Dragging { + source_idx, + hovering_idx, + hovering_last_item, + .. + } = self.detection_state + { + DragDropResponse { + finished: false, + update: Some(DragUpdate { + from: source_idx, + to: if hovering_last_item { + hovering_idx + 1 + } else { + hovering_idx + }, + }), + state: self.detection_state.clone(), + cancellation_reason: None, + has_changed: should_update, } } else { DragDropResponse { diff --git a/crates/egui_flex/Cargo.toml b/crates/egui_flex/Cargo.toml index 81480aa..d67ae65 100644 --- a/crates/egui_flex/Cargo.toml +++ b/crates/egui_flex/Cargo.toml @@ -8,4 +8,7 @@ egui.workspace = true [dev-dependencies] eframe = { workspace = true, default-features = true } -egui_inbox.workspace = true \ No newline at end of file +egui_inbox.workspace = true + +[lints] +workspace = true diff --git a/crates/egui_flex/examples/flex_customize_example.rs b/crates/egui_flex/examples/flex_customize_example.rs index 9713328..2b0f8e1 100644 --- a/crates/egui_flex/examples/flex_customize_example.rs +++ b/crates/egui_flex/examples/flex_customize_example.rs @@ -23,8 +23,8 @@ struct Item { impl Item { pub fn show(&mut self, ui: &mut FlexInstance) { let response = match &self.kind { - ItemKind::Button(text) => ui.add(self.flex.clone(), Button::new(text)).inner, - ItemKind::Label(text) => ui.add_simple(self.flex.clone(), |ui| ui.label(text)).inner, + ItemKind::Button(text) => ui.add(self.flex, Button::new(text)).inner, + ItemKind::Label(text) => ui.add_simple(self.flex, |ui| ui.label(text)).inner, }; response.context_menu(|ui| { @@ -115,7 +115,7 @@ fn main() { ui.set_width(ui.available_width()); ui.set_height(ui.available_height()); demo.flex.clone().show(ui, |flex| { - for item in demo.items.iter_mut() { + for item in &mut demo.items { item.show(flex); } }); diff --git a/crates/egui_flex/examples/flex_demos.rs b/crates/egui_flex/examples/flex_demos.rs index 8442e2e..d28756f 100644 --- a/crates/egui_flex/examples/flex_demos.rs +++ b/crates/egui_flex/examples/flex_demos.rs @@ -1,6 +1,20 @@ +use eframe::NativeOptions; use egui::{Align2, Button, CentralPanel, ComboBox, Frame}; use egui_flex::{Flex, FlexAlign, FlexAlignContent, FlexDirection, FlexInstance, FlexItem}; +const ALIGNS: [Align2; 9] = [ + Align2::LEFT_TOP, + Align2::CENTER_TOP, + Align2::RIGHT_TOP, + Align2::LEFT_CENTER, + Align2::CENTER_CENTER, + Align2::RIGHT_CENTER, + Align2::LEFT_BOTTOM, + Align2::CENTER_BOTTOM, + Align2::RIGHT_BOTTOM, +]; + +#[allow(clippy::too_many_lines)] // It's an example fn main() -> eframe::Result { let mut demo_dir = FlexDirection::Horizontal; @@ -8,216 +22,209 @@ fn main() -> eframe::Result { let mut align_self_content: usize = 0; - eframe::run_simple_native("egui_flex demos", Default::default(), move |ctx, _frame| { - CentralPanel::default().show(ctx, |ui| { - let frame = Frame::group(ui.style()); - - Flex::new().show(ui, |flex| { - flex.add_simple(FlexItem::new(), |ui| { - ui.label("Demo direction:"); + eframe::run_simple_native( + "egui_flex demos", + NativeOptions::default(), + move |ctx, _frame| { + CentralPanel::default().show(ctx, |ui| { + let frame = Frame::group(ui.style()); + + Flex::new().show(ui, |flex| { + flex.add_simple(FlexItem::new(), |ui| { + ui.label("Demo direction:"); + }); + if flex + .add( + FlexItem::new(), + Button::new("Horizontal") + .selected(demo_dir == FlexDirection::Horizontal), + ) + .inner + .clicked() + { + demo_dir = FlexDirection::Horizontal; + }; + if flex + .add( + FlexItem::new(), + Button::new("Vertical").selected(demo_dir == FlexDirection::Vertical), + ) + .inner + .clicked() + { + demo_dir = FlexDirection::Vertical; + }; + + flex.add_simple(FlexItem::new(), |ui| ui.checkbox(&mut grow, "Grow")); }); - if flex - .add( - FlexItem::new(), - Button::new("Horizontal").selected(demo_dir == FlexDirection::Horizontal), - ) - .inner - .clicked() - { - demo_dir = FlexDirection::Horizontal; - }; - if flex - .add( - FlexItem::new(), - Button::new("Vertical").selected(demo_dir == FlexDirection::Vertical), - ) - .inner - .clicked() - { - demo_dir = FlexDirection::Vertical; - }; - flex.add_simple(FlexItem::new(), |ui| ui.checkbox(&mut grow, "Grow")); - }); + let main_dir = if demo_dir == FlexDirection::Horizontal { + FlexDirection::Vertical + } else { + FlexDirection::Horizontal + }; + let grow_items = if grow { 1.0 } else { 0.0 }; - let main_dir = if demo_dir == FlexDirection::Horizontal { - FlexDirection::Vertical - } else { - FlexDirection::Horizontal - }; - let grow_items = if grow { 1.0 } else { 0.0 }; + let heading = |flex: &mut FlexInstance, heading| { + flex.add_simple(FlexItem::new().grow(0.0), |ui| { + ui.heading(heading); + }); + }; - let heading = |flex: &mut FlexInstance, heading| { - flex.add_simple(FlexItem::new().grow(0.0), |ui| { - ui.heading(heading); - }); - }; - - Flex::new() - .direction(main_dir) - .align_content(FlexAlignContent::Normal) - .grow_items(1.0) - .show(ui, |flex| { - flex.add_flex_frame( - FlexItem::new(), - Flex::new().direction(demo_dir).grow_items(grow_items), - frame, - |flex| { - heading(flex, "Align"); - - [ - FlexAlign::Start, - FlexAlign::Center, - FlexAlign::End, - FlexAlign::Stretch, - ] - .iter() - .for_each(|align| { - flex.add_frame(FlexItem::new().align_self(*align), frame, |ui| { - ui.label(format!("{:?}", align)); - }); - }); - - flex.add_frame(FlexItem::new(), frame, |ui| { - ui.label("Some bigger item\nwith some\nmore lines") - }); - }, - ); - - flex.add_flex_frame( - FlexItem::new(), - Flex::new().direction(demo_dir), - frame, - |flex| { - heading(flex, "Grow"); - - [0.0, 1.0, 2.0, 3.0].iter().for_each(|grow| { - flex.add_frame(FlexItem::new().grow(*grow), frame, |ui| { - ui.label(format!("{:?}", grow)); - }); - }); - }, - ); - - flex.add_flex_frame( - FlexItem::new(), - Flex::new().direction(demo_dir).grow_items(grow_items), - frame, - |flex| { - heading(flex, "Basis"); - - [0.0, 50.0, 100.0, 200.0].iter().for_each(|basis| { - flex.add_frame(FlexItem::new().basis(*basis), frame, |ui| { - ui.label(format!("{:?}", basis)); - }); - }); - }, - ); - - flex.add_flex_frame( - FlexItem::new(), - Flex::new().direction(demo_dir).grow_items(grow_items), - frame, - |flex| { - heading(flex, "Nested"); - - flex.add_flex_frame( - FlexItem::new(), - Flex::new().direction(main_dir).grow_items(grow_items), - frame, - |flex| { - flex.add_frame(FlexItem::new(), frame, |ui| { - ui.label("one"); - }); - flex.add_flex_frame( - FlexItem::new(), - Flex::new().direction(demo_dir).grow_items(grow_items), + Flex::new() + .direction(main_dir) + .align_content(FlexAlignContent::Normal) + .grow_items(1.0) + .show(ui, |flex| { + flex.add_flex_frame( + FlexItem::new(), + Flex::new().direction(demo_dir).grow_items(grow_items), + frame, + |flex| { + heading(flex, "Align"); + + for align in &[ + FlexAlign::Start, + FlexAlign::Center, + FlexAlign::End, + FlexAlign::Stretch, + ] { + flex.add_frame( + FlexItem::new().align_self(*align), frame, - |flex| { - flex.add_frame(FlexItem::new(), frame, |ui| { - ui.label("two"); - }); - flex.add_frame(FlexItem::new(), frame, |ui| { - ui.label("three"); - }); + |ui| { + ui.label(format!("{align:?}")); }, ); - }, - ); - flex.add_flex_frame( - FlexItem::new(), - Flex::new().direction(main_dir).grow_items(grow_items), - frame, - |flex| { - flex.add_frame(FlexItem::new(), frame, |ui| { - ui.label("one"); - }); - flex.add_frame(FlexItem::new(), frame, |ui| { - ui.label("two"); + } + + flex.add_frame(FlexItem::new(), frame, |ui| { + ui.label("Some bigger item\nwith some\nmore lines") + }); + }, + ); + + flex.add_flex_frame( + FlexItem::new(), + Flex::new().direction(demo_dir), + frame, + |flex| { + heading(flex, "Grow"); + + for grow in &[0.0, 1.0, 2.0, 3.0] { + flex.add_frame(FlexItem::new().grow(*grow), frame, |ui| { + ui.label(format!("{grow:?}")); }); - flex.add_frame(FlexItem::new(), frame, |ui| { - ui.label("three"); + } + }, + ); + + flex.add_flex_frame( + FlexItem::new(), + Flex::new().direction(demo_dir).grow_items(grow_items), + frame, + |flex| { + heading(flex, "Basis"); + + for basis in &[0.0, 50.0, 100.0, 200.0] { + flex.add_frame(FlexItem::new().basis(*basis), frame, |ui| { + ui.label(format!("{basis:?}")); }); - }, - ); - }, - ); - - flex.add_flex_frame( - FlexItem::new(), - Flex::new().direction(demo_dir).grow_items(grow_items), - frame, - |flex| { - heading(flex, "Align Self Content"); - - const ALIGNS: [Align2; 9] = [ - Align2::LEFT_TOP, - Align2::CENTER_TOP, - Align2::RIGHT_TOP, - Align2::LEFT_CENTER, - Align2::CENTER_CENTER, - Align2::RIGHT_CENTER, - Align2::LEFT_BOTTOM, - Align2::CENTER_BOTTOM, - Align2::RIGHT_BOTTOM, - ]; - - flex.add_simple(FlexItem::new(), |ui| { - ComboBox::new("self content", "").show_index( - ui, - &mut align_self_content, - ALIGNS.len(), - |index| format!("{:?}", ALIGNS[index]), + } + }, + ); + + flex.add_flex_frame( + FlexItem::new(), + Flex::new().direction(demo_dir).grow_items(grow_items), + frame, + |flex| { + heading(flex, "Nested"); + + flex.add_flex_frame( + FlexItem::new(), + Flex::new().direction(main_dir).grow_items(grow_items), + frame, + |flex| { + flex.add_frame(FlexItem::new(), frame, |ui| { + ui.label("one"); + }); + flex.add_flex_frame( + FlexItem::new(), + Flex::new().direction(demo_dir).grow_items(grow_items), + frame, + |flex| { + flex.add_frame(FlexItem::new(), frame, |ui| { + ui.label("two"); + }); + flex.add_frame(FlexItem::new(), frame, |ui| { + ui.label("three"); + }); + }, + ); + }, ); - }); - - let align_content = ALIGNS[align_self_content]; - - [ - FlexAlign::Start, - FlexAlign::Center, - FlexAlign::End, - FlexAlign::Stretch, - ] - .iter() - .for_each(|align| { - flex.add_frame( - FlexItem::new() - .align_self(*align) - .align_self_content(align_content), + flex.add_flex_frame( + FlexItem::new(), + Flex::new().direction(main_dir).grow_items(grow_items), frame, - |ui| { - ui.label(format!("{:?}", align)); + |flex| { + flex.add_frame(FlexItem::new(), frame, |ui| { + ui.label("one"); + }); + flex.add_frame(FlexItem::new(), frame, |ui| { + ui.label("two"); + }); + flex.add_frame(FlexItem::new(), frame, |ui| { + ui.label("three"); + }); }, ); - }); + }, + ); + + flex.add_flex_frame( + FlexItem::new(), + Flex::new().direction(demo_dir).grow_items(grow_items), + frame, + |flex| { + heading(flex, "Align Self Content"); + + flex.add_simple(FlexItem::new(), |ui| { + ComboBox::new("self content", "").show_index( + ui, + &mut align_self_content, + ALIGNS.len(), + |index| format!("{:?}", ALIGNS[index]), + ); + }); - flex.add_frame(FlexItem::new(), frame, |ui| { - ui.label("Some bigger item\nwith some\nmore lines") - }); - }, - ); - }); - }); - }) + let align_content = ALIGNS[align_self_content]; + + for align in &[ + FlexAlign::Start, + FlexAlign::Center, + FlexAlign::End, + FlexAlign::Stretch, + ] { + flex.add_frame( + FlexItem::new() + .align_self(*align) + .align_self_content(align_content), + frame, + |ui| { + ui.label(format!("{align:?}")); + }, + ); + } + + flex.add_frame(FlexItem::new(), frame, |ui| { + ui.label("Some bigger item\nwith some\nmore lines") + }); + }, + ); + }); + }); + }, + ) } diff --git a/crates/egui_flex/examples/flex_example.rs b/crates/egui_flex/examples/flex_example.rs index 004119f..642aca0 100644 --- a/crates/egui_flex/examples/flex_example.rs +++ b/crates/egui_flex/examples/flex_example.rs @@ -3,6 +3,7 @@ use egui::{Button, CentralPanel, Checkbox, Frame, Label, Slider, TextEdit, Widge use egui_flex::{Flex, FlexAlign, FlexItem}; use std::num::NonZeroUsize; +#[allow(clippy::too_many_lines)] // It's an example fn main() -> eframe::Result { let mut text = "Hello, world!".to_owned(); eframe::run_simple_native( @@ -80,25 +81,23 @@ fn main() -> eframe::Result { }, ); - [ + for align in &[ FlexAlign::Start, FlexAlign::End, FlexAlign::Center, FlexAlign::Stretch, - ] - .iter() - .for_each(|align| { + ] { flex.add_frame( FlexItem::default().grow(1.0).align_self(*align), Frame::group(flex.ui().style()), |ui| { ui.add( - Label::new(format!("I have align-self: {:?}", align)) + Label::new(format!("I have align-self: {align:?}")) .wrap(), ); }, ); - }); + } flex.add_simple(FlexItem::new().grow(1.0).basis(150.0), |ui| { ui.style_mut().spacing.slider_width = ui.available_width() - 50.0; diff --git a/crates/egui_flex/examples/flex_nested.rs b/crates/egui_flex/examples/flex_nested.rs index 64c1a05..e2e43c4 100644 --- a/crates/egui_flex/examples/flex_nested.rs +++ b/crates/egui_flex/examples/flex_nested.rs @@ -1,3 +1,4 @@ +use eframe::NativeOptions; use egui::{Button, CentralPanel, Checkbox, DragValue, Frame, TextEdit, Vec2}; use egui_flex::{Flex, FlexAlignContent, FlexItem}; @@ -6,103 +7,110 @@ fn main() -> eframe::Result { let mut txt = String::new(); - eframe::run_simple_native("flex nested", Default::default(), move |ctx, _frame| { - CentralPanel::default().show(ctx, |ui| { - ui.spacing_mut().item_spacing = Vec2::splat(10.0); - let frame = Frame::group(ui.style()); - Flex::horizontal() - .align_content(FlexAlignContent::Normal) - .grow_items(1.0) - .show(ui, |flex| { - flex.add_flex_frame( - FlexItem::new(), - Flex::vertical() - .align_content(FlexAlignContent::Stretch) - .grow_items(1.0), - Frame::group(flex.ui().style()), - |flex| { - flex.add(FlexItem::new(), Button::new("btn")); - // flex.add( - // FlexItem::new(), - // Slider::new(&mut flt, 0.0..=1000.0).show_value(false), - // ); - flex.add( - FlexItem::new().grow(0.0), - TextEdit::singleline(&mut txt).desired_width(100.0), - ); - flex.add(FlexItem::new(), DragValue::new(&mut flt)); - flex.add(FlexItem::new(), Checkbox::new(&mut false, "Checkbox")); - }, - ); + eframe::run_simple_native( + "flex nested", + NativeOptions::default(), + move |ctx, _frame| { + CentralPanel::default().show(ctx, |ui| { + ui.spacing_mut().item_spacing = Vec2::splat(10.0); + let frame = Frame::group(ui.style()); + Flex::horizontal() + .align_content(FlexAlignContent::Normal) + .grow_items(1.0) + .show(ui, |flex| { + flex.add_flex_frame( + FlexItem::new(), + Flex::vertical() + .align_content(FlexAlignContent::Stretch) + .grow_items(1.0), + Frame::group(flex.ui().style()), + |flex| { + flex.add(FlexItem::new(), Button::new("btn")); + // flex.add( + // FlexItem::new(), + // Slider::new(&mut flt, 0.0..=1000.0).show_value(false), + // ); + flex.add( + FlexItem::new().grow(0.0), + TextEdit::singleline(&mut txt).desired_width(100.0), + ); + flex.add(FlexItem::new(), DragValue::new(&mut flt)); + flex.add(FlexItem::new(), Checkbox::new(&mut false, "Checkbox")); + }, + ); - flex.add(FlexItem::new().grow(1.0), Button::new("Single Button")); + flex.add(FlexItem::new().grow(1.0), Button::new("Single Button")); - flex.add_flex_frame( - FlexItem::new().grow(1.0), - Flex::vertical() - .align_content(FlexAlignContent::Stretch) - .grow_items(1.0), - frame, - |flex| { - flex.add(FlexItem::new().grow(1.0), Button::new("btn")); - flex.add(FlexItem::new(), Button::new("Very long button")); - }, - ); + flex.add_flex_frame( + FlexItem::new().grow(1.0), + Flex::vertical() + .align_content(FlexAlignContent::Stretch) + .grow_items(1.0), + frame, + |flex| { + flex.add(FlexItem::new().grow(1.0), Button::new("btn")); + flex.add(FlexItem::new(), Button::new("Very long button")); + }, + ); + + flex.add_flex_frame( + FlexItem::new().grow(1.0), + Flex::vertical() + .align_content(FlexAlignContent::Stretch) + .grow_items(1.0), + frame, + |flex| { + flex.add_flex_frame( + FlexItem::new().grow(1.0), + Flex::horizontal() + .align_content(FlexAlignContent::Stretch) + .grow_items(1.0), + frame, + |flex| { + flex.add(FlexItem::new().grow(1.0), Button::new("btn")); + flex.add(FlexItem::new(), Button::new("Very long button")); + + flex.add_flex_frame( + FlexItem::new().grow(1.0), + Flex::vertical() + .align_content(FlexAlignContent::Stretch) + .grow_items(1.0), + Frame::group(flex.ui().style()), + |flex| { + flex.add( + FlexItem::new().grow(1.0), + Button::new("btn"), + ); + flex.add( + FlexItem::new(), + Button::new("Very long button"), + ); + }, + ); + }, + ); + + flex.add(FlexItem::new().grow(1.0), Button::new("btn")); + flex.add(FlexItem::new(), Button::new("Very long button")); + flex.add(FlexItem::new(), Button::new("btn")); + }, + ); + }); + Flex::vertical().show(ui, |flex| { flex.add_flex_frame( - FlexItem::new().grow(1.0), - Flex::vertical() - .align_content(FlexAlignContent::Stretch) + FlexItem::new(), + Flex::horizontal() + .align_content(FlexAlignContent::Normal) .grow_items(1.0), - frame, + Frame::group(flex.ui().style()), |flex| { - flex.add_flex_frame( - FlexItem::new().grow(1.0), - Flex::horizontal() - .align_content(FlexAlignContent::Stretch) - .grow_items(1.0), - frame, - |flex| { - flex.add(FlexItem::new().grow(1.0), Button::new("btn")); - flex.add(FlexItem::new(), Button::new("Very long button")); - - flex.add_flex_frame( - FlexItem::new().grow(1.0), - Flex::vertical() - .align_content(FlexAlignContent::Stretch) - .grow_items(1.0), - Frame::group(flex.ui().style()), - |flex| { - flex.add(FlexItem::new().grow(1.0), Button::new("btn")); - flex.add( - FlexItem::new(), - Button::new("Very long button"), - ); - }, - ); - }, - ); - flex.add(FlexItem::new().grow(1.0), Button::new("btn")); flex.add(FlexItem::new(), Button::new("Very long button")); - flex.add(FlexItem::new(), Button::new("btn")); }, ); - }); - - Flex::vertical().show(ui, |flex| { - flex.add_flex_frame( - FlexItem::new(), - Flex::horizontal() - .align_content(FlexAlignContent::Normal) - .grow_items(1.0), - Frame::group(flex.ui().style()), - |flex| { - flex.add(FlexItem::new().grow(1.0), Button::new("btn")); - flex.add(FlexItem::new(), Button::new("Very long button")); - }, - ); - }) - }); - }) + }) + }); + }, + ) } diff --git a/crates/egui_flex/examples/simple_horizontal.rs b/crates/egui_flex/examples/simple_horizontal.rs index de7d49d..a8a9f9e 100644 --- a/crates/egui_flex/examples/simple_horizontal.rs +++ b/crates/egui_flex/examples/simple_horizontal.rs @@ -1,16 +1,21 @@ +use eframe::NativeOptions; use egui::{Button, CentralPanel}; use egui_flex::{Flex, FlexItem}; fn main() -> eframe::Result { - eframe::run_simple_native("simple_horizontal", Default::default(), |ctx, _frame| { - CentralPanel::default().show(ctx, |ui| { - Flex::horizontal().show(ui, |flex| { - for i in 0..10 { - flex.add(FlexItem::new(), Button::new(format!("Button {}", i))); - } + eframe::run_simple_native( + "simple_horizontal", + NativeOptions::default(), + |ctx, _frame| { + CentralPanel::default().show(ctx, |ui| { + Flex::horizontal().show(ui, |flex| { + for i in 0..10 { + flex.add(FlexItem::new(), Button::new(format!("Button {i}"))); + } - flex.add(FlexItem::new(), Button::new("Button \n 2 line")); + flex.add(FlexItem::new(), Button::new("Button \n 2 line")); + }); }); - }); - }) + }, + ) } diff --git a/crates/egui_flex/src/flex_widget.rs b/crates/egui_flex/src/flex_widget.rs index 74e6cd1..7a4cf51 100644 --- a/crates/egui_flex/src/flex_widget.rs +++ b/crates/egui_flex/src/flex_widget.rs @@ -23,8 +23,11 @@ pub trait FlexWidget { } mod egui_widgets { - use super::*; - use egui::widgets::*; + use super::{FlexContainerResponse, FlexContainerUi, FlexWidget, Ui}; + use egui::widgets::{ + Button, Checkbox, DragValue, Hyperlink, Image, ImageButton, Label, Link, ProgressBar, + RadioButton, SelectableLabel, Slider, Spinner, TextEdit, + }; macro_rules! impl_widget { ($($widget:ty),*) => { $( diff --git a/crates/egui_flex/src/lib.rs b/crates/egui_flex/src/lib.rs index 883cf09..93725ab 100644 --- a/crates/egui_flex/src/lib.rs +++ b/crates/egui_flex/src/lib.rs @@ -71,7 +71,7 @@ impl Default for Flex { } } -#[derive(Debug, Clone, Default, PartialEq)] +#[derive(Debug, Clone, Copy, Default, PartialEq)] pub struct FlexItem { grow: Option, basis: Option, @@ -99,7 +99,7 @@ impl FlexItem { self } - /// If align_self is stretch, how do we align the content? + /// If `align_self` is stretch, how do we align the content? pub fn align_self_content(mut self, align_self_content: Align2) -> Self { self.align_content = Some(align_self_content); self @@ -191,11 +191,7 @@ impl Flex { // We ceil in order to prevent rounding errors to wrap the layout unexpectedly let available_size = target_size.unwrap_or(ui.available_size()).ceil(); - let direction = if ui.layout().main_dir().is_horizontal() { - 0 - } else { - 1 - }; + let direction = usize::from(!ui.layout().main_dir().is_horizontal()); let cross_direction = 1 - direction; let rows = self.layout_rows( @@ -206,14 +202,6 @@ impl Flex { ui.min_rect().min, ); - // for row in &rows { - // ui.ctx().debug_painter().debug_rect( - // row.rect.unwrap(), - // egui::Color32::from_rgba_unmultiplied(0, 255, 0, 128), - // format!("row"), - // ); - // } - let max_item_size = max_item_size.unwrap_or(ui.available_size()); let mut instance = FlexInstance { @@ -259,15 +247,6 @@ impl Flex { // }); if previous_state != instance.state { - // println!("State changed"); - // for i in 0..instance.state.items.len() { - // if let Some(prev_item) = previous_state.items.get(i) { - // let item = &instance.state.items[i]; - // if prev_item != item { - // dbg!(i, prev_item, item); - // } - // } - // } instance .ui .ctx() @@ -309,8 +288,9 @@ impl Flex { let item_length = item .config .basis - .map(|basis| basis + item.margin.sum()[direction]) - .unwrap_or(item.size_with_margin[direction]); + .map_or(item.size_with_margin[direction], |basis| { + basis + item.margin.sum()[direction] + }); if item_length + gap_direction + current_row.total_size > available_length && !current_row.items.is_empty() @@ -353,7 +333,7 @@ impl Flex { let mut row_position = min_position; - for row in rows.iter_mut() { + for row in &mut rows { let mut row_size = Vec2::ZERO; row_size[direction] = available_length; row_size[cross_direction] = row.cross_size + extra_cross_space_per_row; @@ -364,12 +344,6 @@ impl Flex { row.cross_size_with_extra_space = row_size[cross_direction]; row.rect = Some(Rect::from_min_size(row_position, row_size)); - // ctx.debug_painter().debug_rect( - // row.rect.unwrap(), - // egui::Color32::from_rgba_unmultiplied(0, 255, 0, 128), - // format!("row {}", i), - // ); - row_position[cross_direction] += row_size[cross_direction] + gap[cross_direction]; row.extra_space = available_length - row.total_size; @@ -377,10 +351,10 @@ impl Flex { rows } - /// Show the flex ui. It will try to stay within Ui::max_rect. + /// Show the flex ui. It will try to stay within `Ui::max_rect`. /// - /// Note: You will likely get weird results when showing this within a Ui::horizontal layout, - /// since it limits the max_rect to some small value. Use Ui::horizontal_top instead. + /// Note: You will likely get weird results when showing this within a `Ui::horizontal` layout, + /// since it limits the `max_rect` to some small value. Use `Ui::horizontal_top` instead. pub fn show(self, ui: &mut Ui, f: impl FnOnce(&mut FlexInstance) -> R) -> InnerResponse { self.show_inside(ui, None, None, f).1 } @@ -431,23 +405,8 @@ pub struct FlexInstance<'a> { impl<'a> FlexInstance<'a> { fn row_ui(parent: &mut Ui, row: Option<&RowData>) -> Ui { - let rect = row - .map(|row| row.rect.unwrap()) - .unwrap_or(parent.max_rect()); - - // parent.ctx().debug_painter().debug_rect( - // rect, - // egui::Color32::from_rgba_unmultiplied(255, 0, 0, 128), - // format!("row {}", 0), - // ); - // parent.ctx().debug_painter().debug_rect( - // rect, - // egui::Color32::from_rgba_unmultiplied(0, 0, 255, 255), - // format!("row"), - // ); - - // child.set_width(child.available_width()); - // child.set_height(child.available_height()); + let rect = row.map_or(parent.max_rect(), |row| row.rect.unwrap()); + parent.new_child(UiBuilder::new().max_rect(rect)) } @@ -467,6 +426,7 @@ impl<'a> FlexInstance<'a> { self.ui } + #[allow(clippy::too_many_lines)] // TODO: Refactor this to be more readable pub fn add_container( &mut self, item: FlexItem, @@ -480,12 +440,6 @@ impl<'a> FlexInstance<'a> { }; let row = self.rows.get_mut(self.current_row); - // - // self.row_ui.ctx().debug_painter().debug_rect( - // self.row_ui.min_rect(), - // egui::Color32::from_rgba_unmultiplied(255, 0, 0, 128), - // format!("row {}", self.current_row), - // ); let res = self.row_ui.scope(|ui| { let res = if let Some(row) = row { @@ -520,10 +474,6 @@ impl<'a> FlexInstance<'a> { total_size[self.direction] = f32::min(total_size[self.direction], available_size[self.direction]); } - // total_size[1 - self.direction] = f32::min( - // total_size[1 - self.direction], - // available_size[1 - self.direction], - // ); let align = item.align_self.unwrap_or_default(); @@ -585,20 +535,6 @@ impl<'a> FlexInstance<'a> { ); } - // ui.ctx().debug_painter().debug_rect( - // frame_rect, - // egui::Color32::from_rgba_unmultiplied(255, 0, 0, 128), - // format!("frame_rect {}", self.current_index), - // ); - // - // if item.basis.is_some() { - // ui.ctx().debug_painter().debug_rect( - // content_rect, - // egui::Color32::from_rgba_unmultiplied(0, 255, 0, 128), - // format!("{}", self.current_index), - // ); - // } - let mut child_ui = ui.new_child(UiBuilder::new().max_rect(frame_rect).layout(*ui.layout())); child_ui.spacing_mut().item_spacing = self.item_spacing; @@ -620,11 +556,6 @@ impl<'a> FlexInstance<'a> { }, ); let (_, _r) = ui.allocate_space(child_ui.min_rect().size()); - // ui.ctx().debug_painter().debug_rect( - // ui.min_rect(), - // egui::Color32::from_rgba_unmultiplied(0, 0, 255, 128), - // format!("allocated {}", self.current_index), - // ); (res, row.items.len(), frame_rect) } else { @@ -819,14 +750,6 @@ impl FlexContainerUi { let child_min_rect = child.min_rect(); - // let mut extended_size = child_min_rect.size(); - // if let Some(basis) = basis { - // extended_size[direction] = basis; - // } - // extended_size[direction] += extra_length; - // - // ui.allocate_exact_size(extended_size, Sense::hover()); - ui.allocate_exact_size( Vec2::max(frame_rect.size() - margin.sum(), Vec2::ZERO), Sense::hover(), @@ -850,11 +773,6 @@ impl FlexContainerUi { flex: Flex, content: impl FnOnce(&mut FlexInstance) -> R, ) -> FlexContainerResponse { - // ui.ctx().debug_painter().debug_rect( - // self.frame_rect, - // egui::Color32::from_rgba_unmultiplied(0, 0, 255, 128), - // format!("frame_rect"), - // ); let Self { frame_rect, margin, @@ -930,9 +848,6 @@ impl FlexContainerUi { if remeasure_widget { ui.ctx().request_repaint(); ui.ctx().request_discard("Triggering flex item remeasure"); - - // dbg!(available_size); - // dbg!(intrinsic_size.round(), self.last_inner_size); } FlexContainerResponse { diff --git a/crates/egui_form/Cargo.toml b/crates/egui_form/Cargo.toml index 240c507..f3dbb61 100644 --- a/crates/egui_form/Cargo.toml +++ b/crates/egui_form/Cargo.toml @@ -40,3 +40,6 @@ eframe = { workspace = true, features = ["default"] } garde = { version = "0.18.0", features = ["email", "derive"] } validator = { version = "0.18.1", features = ["derive"] } + +[lints] +workspace = true diff --git a/crates/egui_form/examples/validator.rs b/crates/egui_form/examples/validator.rs index 88882d4..3338e61 100644 --- a/crates/egui_form/examples/validator.rs +++ b/crates/egui_form/examples/validator.rs @@ -63,8 +63,8 @@ fn form_ui(ui: &mut egui::Ui, test: &mut Test) { egui::DragValue::new(&mut test.vec[0].test).range(0..=11), ); - if let Some(Ok(_)) = form.handle_submit(&ui.button("Submit"), ui) { - println!("Form submitted: {:?}", test); + if let Some(Ok(())) = form.handle_submit(&ui.button("Submit"), ui) { + println!("Form submitted: {test:?}"); } } diff --git a/crates/egui_form/src/form.rs b/crates/egui_form/src/form.rs index 42a96b4..bfbc85e 100644 --- a/crates/egui_form/src/form.rs +++ b/crates/egui_form/src/form.rs @@ -31,9 +31,9 @@ impl Form { } /// Add a validation report to the form. - /// This will be either a [crate::validator::ValidatorReport] or a [crate::garde::GardeReport]. + /// This will be either a [`crate::validator::ValidatorReport`] or a [`crate::garde::GardeReport`]. /// You can add multiple reports to the form. - /// You can also pass a custom Report for your own validation logic, if you implement [EguiValidationReport] for it. + /// You can also pass a custom Report for your own validation logic, if you implement [`EguiValidationReport`] for it. pub fn add_report(mut self, value: R) -> Self { self.validation_results.push(value); self @@ -43,7 +43,7 @@ impl Form { /// You usually pass this a button response. /// If this function returns Some(Ok(_)), the form data can be submitted. /// - /// You can also use [EguiValidationReport::try_submit] directly. + /// You can also use [`EguiValidationReport::try_submit`] directly. pub fn handle_submit( &mut self, response: &Response, @@ -62,7 +62,7 @@ impl Form { let has_errors = self .validation_results .iter() - .any(|errors| errors.has_errors()); + .any(super::validation_report::EguiValidationReport::has_errors); if has_errors { ui.memory_mut(|mem| { for control in &self.controls { diff --git a/crates/egui_form/src/form_field.rs b/crates/egui_form/src/form_field.rs index ca214e7..3f087e9 100644 --- a/crates/egui_form/src/form_field.rs +++ b/crates/egui_form/src/form_field.rs @@ -5,7 +5,7 @@ use egui::{Response, RichText, TextStyle, Widget}; use std::borrow::Cow; /// A form field that can be validated. -/// Will color the field red (using the color from [egui::style::Visuals]::error_fg_color) if there is an error. +/// Will color the field red (using the color from [`egui::style::Visuals::error_fg_color`]) if there is an error. /// Will show the error message below the field if the field is blurred and there is an error. pub struct FormField<'a, 'f, Errors: EguiValidationReport> { error: Option>, @@ -14,10 +14,10 @@ pub struct FormField<'a, 'f, Errors: EguiValidationReport> { } impl<'a, 'f, Errors: EguiValidationReport> FormField<'a, 'f, Errors> { - /// Create a new FormField. + /// Create a new `FormField`. /// Pass a [Form] and a reference to the field you want to validate. - /// If you use [crate::garde], just pass the field name / path as a string. - /// If you use [crate::validator], pass a field reference using the [crate::field_path] macro. + /// If you use [`crate::garde`], just pass the field name / path as a string. + /// If you use [`crate::validator`], pass a field reference using the [`crate::field_path`] macro. pub fn new<'c, I: IntoFieldPath>>( form: &'f mut Form, into_field_path: I, @@ -75,8 +75,7 @@ impl<'a, 'f, Errors: EguiValidationReport> FormField<'a, 'f, Errors> { ui.style() .text_styles .get(&TextStyle::Body) - .map(|s| s.size) - .unwrap_or(16.0) + .map_or(16.0, |s| s.size) * 0.9, ), ); diff --git a/crates/egui_form/src/garde.rs b/crates/egui_form/src/garde.rs index 4989fa0..8db4eae 100644 --- a/crates/egui_form/src/garde.rs +++ b/crates/egui_form/src/garde.rs @@ -10,10 +10,12 @@ use garde::Path; /// Create a [garde::Path] to be submitted to [crate::FormField::new] /// Example: /// ```rust -/// use garde::Path; /// use egui_form::garde::field_path; -/// assert_eq!(field_path!("root", "vec", 0, "nested"), Path::new("root") -/// .join("vec").join(0).join("nested")) +/// use garde::Path; +/// assert_eq!( +/// field_path!("root", "vec", 0, "nested"), +/// Path::new("root").join("vec").join(0).join("nested") +/// ) /// ``` #[macro_export] macro_rules! _garde_field_path { @@ -36,26 +38,30 @@ impl GardeReport { /// /// # Example /// ``` - /// use garde::Validate; - /// use egui_form::{EguiValidationReport, IntoFieldPath}; /// use egui_form::garde::{field_path, GardeReport}; + /// use egui_form::{EguiValidationReport, IntoFieldPath}; + /// use garde::Validate; /// #[derive(Validate)] /// struct Test { - /// #[garde(length(min = 3, max = 10))] - /// pub user_name: String, - /// #[garde(inner(length(min = 3, max = 10)))] - /// pub tags: Vec, + /// #[garde(length(min = 3, max = 10))] + /// pub user_name: String, + /// #[garde(inner(length(min = 3, max = 10)))] + /// pub tags: Vec, /// } /// /// let test = Test { - /// user_name: "testfiwuehfwoi".to_string(), - /// tags: vec!["tag1".to_string(), "waaaaytooooloooong".to_string()], + /// user_name: "testfiwuehfwoi".to_string(), + /// tags: vec!["tag1".to_string(), "waaaaytooooloooong".to_string()], /// }; /// /// let report = GardeReport::new(test.validate(&())); /// - /// assert!(report.get_field_error(field_path!("user_name").into_field_path()).is_some()); - /// assert!(report.get_field_error(field_path!("tags", 1).into_field_path()).is_some()); + /// assert!(report + /// .get_field_error(field_path!("user_name").into_field_path()) + /// .is_some()); + /// assert!(report + /// .get_field_error(field_path!("tags", 1).into_field_path()) + /// .is_some()); /// ``` pub fn new(result: Result<(), garde::Report>) -> Self { if let Err(errors) = result { diff --git a/crates/egui_form/src/lib.rs b/crates/egui_form/src/lib.rs index 58a8481..6e63a36 100644 --- a/crates/egui_form/src/lib.rs +++ b/crates/egui_form/src/lib.rs @@ -38,7 +38,8 @@ mod form; /// } /// /// pub fn form_ui(ui: &mut egui::Ui, test: &mut Test) { -/// let mut form = Form::new().add_report(egui_form::garde::GardeReport::new(test.validate(&()))); +/// let mut form = +/// Form::new().add_report(egui_form::garde::GardeReport::new(test.validate(&()))); /// /// FormField::new(&mut form, field_path!("user_name")) /// .label("User Name") @@ -66,10 +67,10 @@ pub mod garde; mod validation_report; mod form_field; -/// To use [validator] with egui_form, you need to create a [validator::ValidatorReport] and pass it to the [Form] instance. +/// To use [validator] with `egui_form`, you need to create a [`validator::ValidatorReport`] and pass it to the [Form] instance. /// -/// Then, when you create a [FormField], you pass a slice of [validator::PathItem]s. -/// Usually, you would use the [field_path!] macro to create the slice. +/// Then, when you create a [`FormField`], you pass a slice of [`validator::PathItem`]s. +/// Usually, you would use the [`field_path`!] macro to create the slice. /// For nested fields and arrays, the syntax for the field name looks like this: /// `field_path!("nested", "array", 0, "field")` /// diff --git a/crates/egui_form/src/validation_report.rs b/crates/egui_form/src/validation_report.rs index 91d0124..7bdbc99 100644 --- a/crates/egui_form/src/validation_report.rs +++ b/crates/egui_form/src/validation_report.rs @@ -1,6 +1,6 @@ use std::borrow::Cow; -/// A trait telling egui_form how to parse validation errors. +/// A trait telling `egui_form` how to parse validation errors. pub trait EguiValidationReport { /// The type used to identify fields. type FieldPath<'a>: Clone; @@ -20,7 +20,7 @@ pub trait EguiValidationReport { fn get_errors(&self) -> Option<&Self::Errors>; } -/// Helper trait to allow constructing non-nested FormFields without using the field_path!() macro +/// Helper trait to allow constructing non-nested `FormFields` without using the `field_path`!() macro pub trait IntoFieldPath { /// Conver this type into a [T] fn into_field_path(self) -> T; diff --git a/crates/egui_form/src/validator.rs b/crates/egui_form/src/validator.rs index f1ecc88..38c0224 100644 --- a/crates/egui_form/src/validator.rs +++ b/crates/egui_form/src/validator.rs @@ -9,7 +9,7 @@ pub use validator; use validator::{Validate, ValidationError, ValidationErrors, ValidationErrorsKind}; /// Represents either a field in a struct or a indexed field in a list. -/// Usually created with the [crate::field_path] macro. +/// Usually created with the [`crate::field_path`] macro. #[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)] pub enum PathItem<'a> { /// Field in a struct. @@ -36,8 +36,8 @@ impl<'a> From<&'a str> for PathItem<'a> { } } -/// Create a field path to be submitted to a [crate::FormField::new]. -/// This macro takes a list of field names and indexes and returns a slice of [PathItem]s. +/// Create a field path to be submitted to a [`crate::FormField::new`]. +/// This macro takes a list of field names and indexes and returns a slice of [`PathItem`]s. /// # Example /// ``` /// use egui_form::validator::{PathItem, field_path}; @@ -69,8 +69,8 @@ pub struct ValidatorReport { } impl ValidatorReport { - /// Create a new [ValidatorReport] from a [validator::ValidationErrors]. - /// You can call this function with the result of a call to [validator::Validate::validate]. + /// Create a new [`ValidatorReport`] from a [`validator::ValidationErrors`]. + /// You can call this function with the result of a call to [`validator::Validate::validate`]. pub fn new(result: Result<(), ValidationErrors>) -> Self { ValidatorReport { errors: result.err(), @@ -78,14 +78,14 @@ impl ValidatorReport { } } - /// Convenience function to validate a value and create a [ValidatorReport] from it. + /// Convenience function to validate a value and create a [`ValidatorReport`] from it. pub fn validate(value: T) -> Self { let result = value.validate(); Self::new(result) } /// Add a custom translation function to the report. - /// Pass a function that takes a [ValidationError] and returns a translated error message. + /// Pass a function that takes a [`ValidationError`] and returns a translated error message. pub fn with_translation Cow<'static, str> + 'static>( mut self, get_t: F, @@ -100,9 +100,8 @@ fn get_error_recursively<'a>( fields: &[PathItem], ) -> Option<&'a Vec> { if let Some((field, rest)) = fields.split_first() { - let field = match field { - PathItem::Field(field) => field, - _ => return None, + let PathItem::Field(field) = field else { + return None; }; match errors.0.get(field.as_ref()) { Some(ValidationErrorsKind::Struct(errors)) => get_error_recursively(errors, rest), diff --git a/crates/egui_inbox/Cargo.toml b/crates/egui_inbox/Cargo.toml index 90adcc3..1e191b4 100644 --- a/crates/egui_inbox/Cargo.toml +++ b/crates/egui_inbox/Cargo.toml @@ -9,7 +9,12 @@ repository = "https://github.com/lucasmerlin/hello_egui/tree/main/crates/egui_in # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [features] -async = ["dep:hello_egui_utils", "hello_egui_utils/async", "dep:futures-channel", "dep:futures"] +async = [ + "dep:hello_egui_utils", + "hello_egui_utils/async", + "dep:futures-channel", + "dep:futures", +] tokio = ["async", "hello_egui_utils/tokio"] egui = ["dep:egui"] default = ["egui"] @@ -48,3 +53,6 @@ ehttp = { version = "0.5.0", features = ["json"] } serde_json = "1" rand = "0.8" derive-new = "0.6" + +[lints] +workspace = true diff --git a/crates/egui_inbox/examples/inbox.rs b/crates/egui_inbox/examples/inbox.rs index e5c6d24..6250ee2 100644 --- a/crates/egui_inbox/examples/inbox.rs +++ b/crates/egui_inbox/examples/inbox.rs @@ -1,4 +1,4 @@ -use eframe::egui; +use eframe::{egui, NativeOptions}; use egui::CentralPanel; use egui_inbox::UiInbox; @@ -8,7 +8,7 @@ pub fn main() -> eframe::Result<()> { eframe::run_simple_native( "DnD Simple Example", - Default::default(), + NativeOptions::default(), move |ctx, _frame| { CentralPanel::default().show(ctx, |ui| { // `read` will return an iterator over all pending messages @@ -18,7 +18,7 @@ pub fn main() -> eframe::Result<()> { // There also is a `replace` method that you can use as a shorthand for the above: // inbox.replace(ui, &mut state); - ui.label(format!("State: {:?}", state)); + ui.label(format!("State: {state:?}")); if ui.button("Async Task").clicked() { state = Some("Waiting for async task to complete".to_string()); let tx = inbox.sender(); diff --git a/crates/egui_inbox/examples/inbox_http.rs b/crates/egui_inbox/examples/inbox_http.rs index 281889f..a779138 100644 --- a/crates/egui_inbox/examples/inbox_http.rs +++ b/crates/egui_inbox/examples/inbox_http.rs @@ -1,4 +1,4 @@ -use eframe::egui; +use eframe::{egui, NativeOptions}; use egui::CentralPanel; use egui_inbox::UiInbox; use ehttp::Request; @@ -33,7 +33,7 @@ impl MyComponent { let json: serde_json::Value = response.json().unwrap(); json["datetime"].as_str().unwrap().to_string() } - Err(err) => format!("Error: {:?}", err), + Err(err) => format!("Error: {err:?}"), }; // Queues the message in the inbox and calls request_repaint so the ui will be updated immediately @@ -43,7 +43,7 @@ impl MyComponent { } if let Some(time) = &self.state { - ui.strong(format!("Time: {:?}", time)); + ui.strong(format!("Time: {time:?}")); } else { ui.label("No time yet"); } @@ -55,7 +55,7 @@ pub fn main() -> eframe::Result<()> { eframe::run_simple_native( "DnD Simple Example", - Default::default(), + NativeOptions::default(), move |ctx, _frame| { CentralPanel::default().show(ctx, |ui| { my_component.ui(ui); diff --git a/crates/egui_inbox/examples/stop_async_task.rs b/crates/egui_inbox/examples/stop_async_task.rs index e7d33be..3cd1b93 100644 --- a/crates/egui_inbox/examples/stop_async_task.rs +++ b/crates/egui_inbox/examples/stop_async_task.rs @@ -1,3 +1,4 @@ +use eframe::NativeOptions; use egui::{CentralPanel, Window}; use egui_inbox::UiInbox; @@ -12,42 +13,46 @@ fn main() -> eframe::Result<()> { let mut id_idx = 0; let mut windows: Vec = Vec::new(); - eframe::run_simple_native("Inbox Example", Default::default(), move |ctx, _frame| { - CentralPanel::default().show(ctx, |ui| { - if ui.button("New Window").clicked() { - id_idx += 1; - let inbox = UiInbox::new(); - let sender = inbox.sender(); - windows.push(MyWindow { - id: id_idx, - count: 0, - inbox, - }); + eframe::run_simple_native( + "Inbox Example", + NativeOptions::default(), + move |ctx, _frame| { + CentralPanel::default().show(ctx, |ui| { + if ui.button("New Window").clicked() { + id_idx += 1; + let inbox = UiInbox::new(); + let sender = inbox.sender(); + windows.push(MyWindow { + id: id_idx, + count: 0, + inbox, + }); - std::thread::spawn(move || { - let mut count = 0; - loop { - std::thread::sleep(std::time::Duration::from_secs(1)); - count += 1; - if sender.send(count).is_err() { - break; + std::thread::spawn(move || { + let mut count = 0; + loop { + std::thread::sleep(std::time::Duration::from_secs(1)); + count += 1; + if sender.send(count).is_err() { + break; + } } - } - // You should see this after closing a window - println!("Stopped thread of window {}", id_idx); - }); - } - - windows.retain_mut(|MyWindow { id, count, inbox }| { - let mut open = true; - Window::new(format!("Window {}", id)) - .open(&mut open) - .show(ui.ctx(), |ui| { - inbox.replace(ui, count); - ui.label(format!("Count: {}", count)); + // You should see this after closing a window + println!("Stopped thread of window {id_idx}"); }); - open + } + + windows.retain_mut(|MyWindow { id, count, inbox }| { + let mut open = true; + Window::new(format!("Window {id}")) + .open(&mut open) + .show(ui.ctx(), |ui| { + inbox.replace(ui, count); + ui.label(format!("Count: {count}")); + }); + open + }); }); - }); - }) + }, + ) } diff --git a/crates/egui_inbox/examples/without_egui.rs b/crates/egui_inbox/examples/without_egui.rs index 0c29bf3..232960b 100644 --- a/crates/egui_inbox/examples/without_egui.rs +++ b/crates/egui_inbox/examples/without_egui.rs @@ -36,7 +36,7 @@ impl MyApplicationState { loop { std::thread::sleep(std::time::Duration::from_secs(1)); count += 1; - sender.send(format!("Count: {}", count)).ok(); + sender.send(format!("Count: {count}")).ok(); } }); diff --git a/crates/egui_inbox/src/lib.rs b/crates/egui_inbox/src/lib.rs index 41ebd77..142ec15 100644 --- a/crates/egui_inbox/src/lib.rs +++ b/crates/egui_inbox/src/lib.rs @@ -10,7 +10,7 @@ pub mod broadcast; #[cfg(feature = "type_broadcast")] pub mod type_broadcast; -/// Type-map based version of [UiInbox], useful for sending messages +/// Type-map based version of [`UiInbox`], useful for sending messages /// to specific components from different parts of the application. #[cfg(feature = "type_inbox")] pub mod type_inbox; @@ -43,12 +43,12 @@ enum RequestRepaintInner { Arc(Arc), } -/// Usually holds a reference to [egui::Context], but can also hold a boxed callback. +/// Usually holds a reference to [`egui::Context`], but can also hold a boxed callback. #[derive(Debug, Clone)] pub struct RequestRepaintContext(RequestRepaintInner); impl RequestRepaintContext { - /// Create a new [RequestRepaintContext] from a callback function. + /// Create a new [`RequestRepaintContext`] from a callback function. pub fn from_callback(f: F) -> Self where F: Fn() + Send + Sync + 'static, @@ -56,7 +56,7 @@ impl RequestRepaintContext { Self(RequestRepaintInner::Arc(Arc::new(f))) } - /// Create a new [RequestRepaintContext] from something that implements [RequestRepaintTrait]. + /// Create a new [`RequestRepaintContext`] from something that implements [`RequestRepaintTrait`]. pub fn from_trait(t: T) -> Self where T: RequestRepaintTrait + Send + Sync + 'static, @@ -64,7 +64,7 @@ impl RequestRepaintContext { Self(RequestRepaintInner::Arc(Arc::new(t))) } - /// Create a new [RequestRepaintContext] from an [egui::Context]. + /// Create a new [`RequestRepaintContext`] from an [`egui::Context`]. #[cfg(feature = "egui")] pub fn from_egui_ctx(ctx: egui::Context) -> Self { Self(RequestRepaintInner::Ctx(ctx)) @@ -87,9 +87,9 @@ impl Debug for RequestRepaintInner { } } -/// Trait to get a [RequestRepaintContext] from. +/// Trait to get a [`RequestRepaintContext`] from. pub trait AsRequestRepaint { - /// Should return a [RequestRepaintContext] that can be used to request a repaint. + /// Should return a [`RequestRepaintContext`] that can be used to request a repaint. fn as_request_repaint(&self) -> RequestRepaintContext; } @@ -142,7 +142,9 @@ mod egui_impl { /// let mut sender = inbox.sender(); /// std::thread::spawn(move || { /// std::thread::sleep(std::time::Duration::from_secs(1)); -/// sender.send(Some("Hello from another thread!".to_string())).ok(); +/// sender +/// .send(Some("Hello from another thread!".to_string())) +/// .ok(); /// }); /// } /// }); @@ -179,7 +181,7 @@ impl State { } } -/// Sender for [UiInbox]. +/// Sender for [`UiInbox`]. pub struct UiInboxSender { state: Arc>>, } @@ -220,9 +222,9 @@ impl Drop for UiInbox { impl UiInbox { /// Create a new inbox. - /// The context is grabbed from the [Ui] passed to [UiInbox::read], so - /// if you call [UiInbox::send] before [UiInbox::read], no repaint is requested. - /// If you want to set the context on creation, use [UiInbox::new_with_ctx]. + /// The context is grabbed from the [Ui] passed to [`UiInbox::read`], so + /// if you call [`UiInbox::send`] before [`UiInbox::read`], no repaint is requested. + /// If you want to set the context on creation, use [`UiInbox::new_with_ctx`]. pub fn new() -> Self { Self::_new(None) } @@ -256,7 +258,7 @@ impl UiInbox { } /// Set the [Context] to use for requesting repaints. - /// Usually this is not needed, since the [Context] is grabbed from the [Ui] passed to [UiInbox::read]. + /// Usually this is not needed, since the [Context] is grabbed from the [Ui] passed to [`UiInbox::read`]. pub fn set_ctx(&mut self, ctx: &impl AsRequestRepaint) { self.state.lock().ctx = Some(ctx.as_request_repaint()); } @@ -275,9 +277,9 @@ impl UiInbox { mem::take(&mut state.queue).into_iter() } - /// Same as [UiInbox::read], but you don't need to pass a reference to [Ui]. - /// If you use this, make sure you set the [Context] with [UiInbox::set_ctx] or - /// [UiInbox::new_with_ctx] manually. + /// Same as [`UiInbox::read`], but you don't need to pass a reference to [Ui]. + /// If you use this, make sure you set the [Context] with [`UiInbox::set_ctx`] or + /// [`UiInbox::new_with_ctx`] manually. pub fn read_without_ctx(&self) -> impl Iterator { let mut state = self.state.lock(); mem::take(&mut state.queue).into_iter() @@ -307,7 +309,7 @@ impl UiInbox { } /// Replaces the value of the options with [Some] if there is an item in the inbox. - /// Otherwise, similar to [UiInbox::replace]. + /// Otherwise, similar to [`UiInbox::replace`]. pub fn replace_option(&self, ui: &impl AsRequestRepaint, target: &mut Option) { let mut state = self.state.lock(); if state.ctx.is_none() { @@ -320,9 +322,9 @@ impl UiInbox { } } - /// Same as [UiInbox::replace], but you don't need to pass a reference to [Ui]. - /// If you use this, make sure you set the [Context] with [UiInbox::set_ctx] or - /// [UiInbox::new_with_ctx] manually. + /// Same as [`UiInbox::replace`], but you don't need to pass a reference to [Ui]. + /// If you use this, make sure you set the [Context] with [`UiInbox::set_ctx`] or + /// [`UiInbox::new_with_ctx`] manually. pub fn replace_without_ctx(&self, target: &mut T) -> bool { let mut state = self.state.lock(); let item = mem::take(&mut state.queue).pop(); diff --git a/crates/egui_inbox/src/type_inbox.rs b/crates/egui_inbox/src/type_inbox.rs index 9778678..da41305 100644 --- a/crates/egui_inbox/src/type_inbox.rs +++ b/crates/egui_inbox/src/type_inbox.rs @@ -28,17 +28,17 @@ struct TypeInboxInner { ctx: RequestRepaintContext, } -/// A type-map based version of [UiInbox] which can be used to send messages +/// A type-map based version of [`UiInbox`] which can be used to send messages /// to a component from different parts of the application. /// -/// Use [crate::TypeBroadcast] instead, if you want to send messages to multiple components (mpmc like channel). +/// Use [`crate::TypeBroadcast`] instead, if you want to send messages to multiple components (mpmc like channel). #[derive(Clone, Debug)] pub struct TypeInbox(Arc>); impl TypeInbox { - /// Create a new [TypeInbox] with the given [RequestRepaintContext]. - /// Usually, this would be a [egui::Context]. - pub fn new(ctx: impl AsRequestRepaint + 'static) -> Self { + /// Create a new [`TypeInbox`] with the given [`RequestRepaintContext`]. + /// Usually, this would be a [`egui::Context`]. + pub fn new(ctx: &(impl AsRequestRepaint + 'static)) -> Self { Self(Arc::new(Mutex::new(TypeInboxInner { map: TypeMap::new(), ctx: ctx.as_request_repaint(), diff --git a/crates/egui_infinite_scroll/Cargo.toml b/crates/egui_infinite_scroll/Cargo.toml index 58f2813..c911337 100644 --- a/crates/egui_infinite_scroll/Cargo.toml +++ b/crates/egui_infinite_scroll/Cargo.toml @@ -37,3 +37,6 @@ eframe = { workspace = true, default-features = true } rand = "0.8" tokio = { version = "1", features = ["full"] } + +[lints] +workspace = true diff --git a/crates/egui_infinite_scroll/examples/infinite_scroll.rs b/crates/egui_infinite_scroll/examples/infinite_scroll.rs index 8d4de05..ebc336e 100644 --- a/crates/egui_infinite_scroll/examples/infinite_scroll.rs +++ b/crates/egui_infinite_scroll/examples/infinite_scroll.rs @@ -1,4 +1,4 @@ -use eframe::egui; +use eframe::{egui, NativeOptions}; use egui::{CentralPanel, ScrollArea}; use egui_infinite_scroll::InfiniteScroll; @@ -11,7 +11,7 @@ pub fn main() -> eframe::Result<()> { eframe::run_simple_native( "Infinite Scroll Simple Example", - Default::default(), + NativeOptions::default(), move |ctx, _frame| { CentralPanel::default().show(ctx, |ui| { ScrollArea::vertical().show(ui, |ui| { @@ -21,7 +21,7 @@ pub fn main() -> eframe::Result<()> { }; infinite_scroll.ui(ui, 10, |ui, _index, item| { - ui.label(format!("Item {}", item)); + ui.label(format!("Item {item}")); }); }); }); diff --git a/crates/egui_infinite_scroll/examples/infinite_scroll_both_directions.rs b/crates/egui_infinite_scroll/examples/infinite_scroll_both_directions.rs index a5c8724..89a7112 100644 --- a/crates/egui_infinite_scroll/examples/infinite_scroll_both_directions.rs +++ b/crates/egui_infinite_scroll/examples/infinite_scroll_both_directions.rs @@ -1,4 +1,4 @@ -use eframe::egui; +use eframe::{egui, NativeOptions}; use egui::{CentralPanel, ScrollArea, Spinner}; use std::thread::{sleep, spawn}; @@ -25,7 +25,7 @@ pub fn main() -> eframe::Result<()> { eframe::run_simple_native( "Infinite Scroll Both Directions Example", - Default::default(), + NativeOptions::default(), move |ctx, _frame| { CentralPanel::default().show(ctx, |ui| { ScrollArea::vertical().animated(false).show(ui, |ui| { @@ -38,7 +38,7 @@ pub fn main() -> eframe::Result<()> { }); infinite_scroll.ui(ui, 10, |ui, _index, item| { - ui.label(format!("Item {}", item)); + ui.label(format!("Item {item}")); }); ui.vertical_centered(|ui| { diff --git a/crates/egui_infinite_scroll/examples/infinite_scroll_retry.rs b/crates/egui_infinite_scroll/examples/infinite_scroll_retry.rs index 0e66288..d55d7b7 100644 --- a/crates/egui_infinite_scroll/examples/infinite_scroll_retry.rs +++ b/crates/egui_infinite_scroll/examples/infinite_scroll_retry.rs @@ -1,4 +1,4 @@ -use eframe::egui; +use eframe::{egui, NativeOptions}; use egui::{CentralPanel, ScrollArea}; use egui_infinite_scroll::{InfiniteScroll, LoadingState}; @@ -18,7 +18,7 @@ pub fn main() -> eframe::Result<()> { eframe::run_simple_native( "Infinite Scroll Simple Example", - Default::default(), + NativeOptions::default(), move |ctx, _frame| { CentralPanel::default().show(ctx, |ui| { ScrollArea::vertical().show(ui, |ui| { @@ -28,7 +28,7 @@ pub fn main() -> eframe::Result<()> { }; infinite_scroll.ui(ui, 10, |ui, _index, item| { - ui.label(format!("Item {}", item)); + ui.label(format!("Item {item}")); }); match infinite_scroll.bottom_loading_state() { diff --git a/crates/egui_infinite_scroll/src/lib.rs b/crates/egui_infinite_scroll/src/lib.rs index 251fb16..5562fb5 100644 --- a/crates/egui_infinite_scroll/src/lib.rs +++ b/crates/egui_infinite_scroll/src/lib.rs @@ -30,7 +30,7 @@ pub enum LoadingState { } impl LoadingState { - /// Returns true if the state is [LoadingState::Loading] + /// Returns true if the state is [`LoadingState::Loading`] pub fn loading(&self) -> bool { matches!(self, Self::Loading) } @@ -61,7 +61,7 @@ pub struct InfiniteScroll { filter: Option>, - /// The egui_virtual_list instance. You can use this to customize settings of the virtual list. + /// The `egui_virtual_list` instance. You can use this to customize settings of the virtual list. pub virtual_list: VirtualList, } @@ -173,7 +173,7 @@ impl } /// Retry loading the top items - /// This only works if the top loading state is [LoadingState::Error] + /// This only works if the top loading state is [`LoadingState::Error`] pub fn retry_top(&mut self) { if let LoadingState::Error(_) = self.top_loading_state { self.top_loading_state = LoadingState::Idle; @@ -181,7 +181,7 @@ impl } /// Retry loading the bottom items - /// This only works if the bottom loading state is [LoadingState::Error] + /// This only works if the bottom loading state is [`LoadingState::Error`] pub fn retry_bottom(&mut self) { if let LoadingState::Error(_) = self.bottom_loading_state { self.bottom_loading_state = LoadingState::Idle; @@ -189,7 +189,7 @@ impl } /// Resets the infinite scroll, clearing all items and loading states. - /// This is a alias for [InfiniteScroll::reload]. + /// This is a alias for [`InfiniteScroll::reload`]. pub fn reset(&mut self) { self.items.clear(); self.top_loading_state = LoadingState::Idle; @@ -212,7 +212,7 @@ impl } /// Resets the infinite scroll, clearing all items and loading states. - /// This is a alias for [InfiniteScroll::reset]. + /// This is a alias for [`InfiniteScroll::reset`]. pub fn reload(&mut self) { self.reset(); } diff --git a/crates/egui_pull_to_refresh/Cargo.toml b/crates/egui_pull_to_refresh/Cargo.toml index 89ecd56..35bcf95 100644 --- a/crates/egui_pull_to_refresh/Cargo.toml +++ b/crates/egui_pull_to_refresh/Cargo.toml @@ -15,3 +15,6 @@ egui.workspace = true eframe = { workspace = true, default-features = true } egui_inbox.workspace = true ehttp = "0.5.0" + +[lints] +workspace = true diff --git a/crates/egui_pull_to_refresh/examples/dad_joke.rs b/crates/egui_pull_to_refresh/examples/dad_joke.rs index 5cdcc08..d759c8f 100644 --- a/crates/egui_pull_to_refresh/examples/dad_joke.rs +++ b/crates/egui_pull_to_refresh/examples/dad_joke.rs @@ -1,4 +1,4 @@ -use eframe::egui; +use eframe::{egui, NativeOptions}; use egui::{Align2, Area, CentralPanel, Frame, Id, Vec2}; use ehttp::Request; @@ -14,7 +14,7 @@ pub fn main() -> eframe::Result<()> { eframe::run_simple_native( "Pull to refresh dad jokes", - Default::default(), + NativeOptions::default(), move |ctx, _frame| { CentralPanel::default().show(ctx, |ui| { // Disable text selection, so it doesn't interfere with the drag gesture diff --git a/crates/egui_pull_to_refresh/examples/pull_refresh_minimal.rs b/crates/egui_pull_to_refresh/examples/pull_refresh_minimal.rs index 0061d56..5287ae7 100644 --- a/crates/egui_pull_to_refresh/examples/pull_refresh_minimal.rs +++ b/crates/egui_pull_to_refresh/examples/pull_refresh_minimal.rs @@ -2,7 +2,7 @@ use std::sync::{Arc, Mutex}; use std::thread; use std::thread::sleep; -use eframe::egui; +use eframe::{egui, NativeOptions}; use egui::{CentralPanel, Ui}; use egui_pull_to_refresh::PullToRefresh; @@ -16,7 +16,7 @@ fn my_ui(ui: &mut Ui, count: u64, loading: bool) -> bool { ui.set_height(ui.available_size().y); ui.label("Pull to refresh demo"); - ui.label(format!("Count: {}", count)); + ui.label(format!("Count: {count}")); }); }); @@ -37,7 +37,7 @@ pub fn main() -> eframe::Result<()> { eframe::run_simple_native( "Pull to refresh minimal example", - Default::default(), + NativeOptions::default(), move |ctx, _frame| { CentralPanel::default().show(ctx, |ui| { // Disable text selection, so it doesn't interfere with the drag gesture diff --git a/crates/egui_pull_to_refresh/examples/pull_refresh_scroll_area.rs b/crates/egui_pull_to_refresh/examples/pull_refresh_scroll_area.rs index 7db689d..90996a8 100644 --- a/crates/egui_pull_to_refresh/examples/pull_refresh_scroll_area.rs +++ b/crates/egui_pull_to_refresh/examples/pull_refresh_scroll_area.rs @@ -2,7 +2,7 @@ use std::sync::{Arc, Mutex}; use std::thread; use std::thread::sleep; -use eframe::egui; +use eframe::{egui, NativeOptions}; use egui::{CentralPanel, ScrollArea}; use egui_pull_to_refresh::PullToRefresh; @@ -23,7 +23,7 @@ pub fn main() -> eframe::Result<()> { eframe::run_simple_native( "Pull to refresh minimal example", - Default::default(), + NativeOptions::default(), move |ctx, _frame| { CentralPanel::default().show(ctx, |ui| { // Disable text selection, so it doesn't interfere with the drag gesture @@ -42,7 +42,7 @@ pub fn main() -> eframe::Result<()> { ui.label("And works with scroll areas!"); let count = current_state.count; for i in count..count + 100 { - ui.label(format!("Hello {}", i)); + ui.label(format!("Hello {i}")); } }) }); diff --git a/crates/egui_pull_to_refresh/src/lib.rs b/crates/egui_pull_to_refresh/src/lib.rs index be85db0..694f5bd 100644 --- a/crates/egui_pull_to_refresh/src/lib.rs +++ b/crates/egui_pull_to_refresh/src/lib.rs @@ -32,7 +32,7 @@ impl PullToRefreshState { match self { PullToRefreshState::Idle => Some(0.0), PullToRefreshState::Dragging { distance, .. } => { - Some((distance / min_distance).clamp(0.0, 1.0) as f64) + Some(f64::from((distance / min_distance).clamp(0.0, 1.0))) } PullToRefreshState::DoRefresh => Some(1.0), PullToRefreshState::Refreshing => None, @@ -120,7 +120,7 @@ impl PullToRefresh { } } - /// Shows the pull to refresh widget, wrapping a [egui::ScrollArea]. + /// Shows the pull to refresh widget, wrapping a [`egui::ScrollArea`]. /// Pass the output of the scroll area to the content function. pub fn scroll_area_ui( self, @@ -140,6 +140,7 @@ impl PullToRefresh { } } + #[allow(clippy::too_many_lines)] // TODO: refactor this to reduce the number of lines fn internal_ui( self, ui: &mut Ui, @@ -227,8 +228,7 @@ impl PullToRefresh { PullToRefreshState::Dragging { .. } => { state.progress(self.min_refresh_distance).unwrap_or(1.0) } - PullToRefreshState::DoRefresh => 1.0, - PullToRefreshState::Refreshing => 1.0, + PullToRefreshState::DoRefresh | PullToRefreshState::Refreshing => 1.0, } as f32; let anim_progress = ui.ctx().animate_value_with_time( @@ -263,7 +263,7 @@ impl PullToRefresh { spinner_color.r(), spinner_color.g(), spinner_color.b(), - (spinner_color.a() as f32 * 0.7).round() as u8, + (f32::from(spinner_color.a()) * 0.7).round() as u8, ); } ProgressSpinner::new() diff --git a/crates/egui_pull_to_refresh/src/progress_spinner.rs b/crates/egui_pull_to_refresh/src/progress_spinner.rs index 6e998ae..e06987a 100644 --- a/crates/egui_pull_to_refresh/src/progress_spinner.rs +++ b/crates/egui_pull_to_refresh/src/progress_spinner.rs @@ -64,7 +64,7 @@ impl ProgressSpinner { let points: Vec = (0..=n_points) .map(|i| { - let angle = lerp(start_angle..=end_angle, i as f64 / n_points as f64); + let angle = lerp(start_angle..=end_angle, f64::from(i) / f64::from(n_points)); let (sin, cos) = angle.sin_cos(); rect.center() + radius * vec2(cos as f32, sin as f32) }) diff --git a/crates/egui_router/Cargo.toml b/crates/egui_router/Cargo.toml index 1ca30e3..04162a1 100644 --- a/crates/egui_router/Cargo.toml +++ b/crates/egui_router/Cargo.toml @@ -32,7 +32,11 @@ thiserror = "1" form_urlencoded = "1" [target.'cfg(target_arch = "wasm32")'.dependencies] -web-sys = { version = "0.3", features = ["History", "PopStateEvent", "HtmlCollection"] } +web-sys = { version = "0.3", features = [ + "History", + "PopStateEvent", + "HtmlCollection", +] } js-sys = "0.3" wasm-bindgen = "0.2" @@ -42,3 +46,6 @@ eframe = { workspace = true, default-features = true } egui_animation = { workspace = true } tokio = { version = "1", features = ["full"] } egui_suspense = { workspace = true, features = ["async", "tokio"] } + +[lints] +workspace = true diff --git a/crates/egui_router/examples/router_minimal.rs b/crates/egui_router/examples/router_minimal.rs index afdb582..4e3cfd2 100644 --- a/crates/egui_router/examples/router_minimal.rs +++ b/crates/egui_router/examples/router_minimal.rs @@ -1,3 +1,4 @@ +#![allow(clippy::needless_pass_by_value)] // It's ok here as it is an example use eframe::NativeOptions; use egui::{CentralPanel, Color32, Frame, ScrollArea, Ui}; use egui_inbox::UiInbox; @@ -82,7 +83,7 @@ fn post(request: Request) -> impl Route { background(ui, ui.style().visuals.extreme_bg_color, |ui| { ScrollArea::vertical().show(ui, |ui| { if let Some(id) = &id { - ui.label(format!("Post: {}", id)); + ui.label(format!("Post: {id}")); if ui.button("back").clicked() { inbox.sender().send(RouterMessage::Back).ok(); diff --git a/crates/egui_router/src/history/memory.rs b/crates/egui_router/src/history/memory.rs index 5e4342d..bf400d8 100644 --- a/crates/egui_router/src/history/memory.rs +++ b/crates/egui_router/src/history/memory.rs @@ -2,7 +2,7 @@ use crate::history::{History, HistoryEvent, HistoryResult}; use egui::Context; use std::iter; -/// A memory history implementation. Currently, this is a no-op, since [EguiRouter] stores the +/// A memory history implementation. Currently, this is a no-op, since [`EguiRouter`] stores the /// history itself, but this could change in the future. #[derive(Debug, Clone, Default)] pub struct MemoryHistory {} diff --git a/crates/egui_router/src/history/mod.rs b/crates/egui_router/src/history/mod.rs index da4b79b..2af8719 100644 --- a/crates/egui_router/src/history/mod.rs +++ b/crates/egui_router/src/history/mod.rs @@ -9,7 +9,7 @@ pub use memory::MemoryHistory; /// Implement this trait to provide a custom history implementation pub trait History { - /// Check whether there is a new HistoryEvent (a navigation occurred) + /// Check whether there is a new `HistoryEvent` (a navigation occurred) fn update(&mut self, ctx: &egui::Context) -> impl Iterator + 'static; /// Get the currently active route fn active_route(&self) -> Option<(String, Option)>; @@ -26,11 +26,11 @@ pub trait History { /// Default history. Uses [BrowserHistory] on wasm32 and [MemoryHistory] otherwise #[cfg(target_arch = "wasm32")] pub type DefaultHistory = history::BrowserHistory; -/// Default history. Uses [BrowserHistory] on wasm32 and [MemoryHistory] otherwise +/// Default history. Uses [`BrowserHistory`] on wasm32 and [`MemoryHistory`] otherwise #[cfg(not(target_arch = "wasm32"))] pub type DefaultHistory = history::MemoryHistory; -/// Result type returned by [History::update] +/// Result type returned by [`History::update`] #[derive(Debug, Clone)] pub struct HistoryEvent { /// The path we are navigating to diff --git a/crates/egui_router/src/lib.rs b/crates/egui_router/src/lib.rs index acf04af..d0c1094 100644 --- a/crates/egui_router/src/lib.rs +++ b/crates/egui_router/src/lib.rs @@ -25,7 +25,7 @@ pub use handler::{HandlerError, HandlerResult}; pub use router::EguiRouter; pub use router_builder::RouterBuilder; -/// A route instance created by a [handler::Handler] +/// A route instance created by a [`handler::Handler`] pub trait Route { /// Render the route ui fn ui(&mut self, ui: &mut egui::Ui, state: &mut State); @@ -33,7 +33,7 @@ pub trait Route { impl Route for F { fn ui(&mut self, ui: &mut egui::Ui, state: &mut State) { - self(ui, state) + self(ui, state); } } @@ -71,7 +71,7 @@ impl From for RouterError { pub struct TransitionConfig { duration: Option, easing: fn(f32) -> f32, - _in: Transition, + in_: Transition, out: Transition, } @@ -80,7 +80,7 @@ impl Default for TransitionConfig { Self { duration: None, easing: ease_in_ease_out, - _in: transition::SlideTransition::new(Vec2::X).into(), + in_: transition::SlideTransition::new(Vec2::X).into(), out: transition::SlideTransition::new(Vec2::X * -0.1).into(), } } @@ -88,15 +88,15 @@ impl Default for TransitionConfig { impl TransitionConfig { /// Create a new transition - pub fn new(_in: impl Into, out: impl Into) -> Self { + pub fn new(in_: impl Into, out: impl Into) -> Self { Self { - _in: _in.into(), + in_: in_.into(), out: out.into(), ..Self::default() } } - /// A iOS-like slide transition (Same as [TransitionConfig::default]) + /// A iOS-like slide transition (Same as [`TransitionConfig::default`]) pub fn slide() -> Self { Self::default() } @@ -140,7 +140,7 @@ struct CurrentTransition { leaving_route: Option>, } -/// Request passed to a [handler::MakeHandler] +/// Request passed to a [`handler::MakeHandler`] pub struct Request<'a, State = ()> { /// The parsed path params pub params: matchit::Params<'a, 'a>, diff --git a/crates/egui_router/src/router.rs b/crates/egui_router/src/router.rs index 045d635..2d9e9b5 100644 --- a/crates/egui_router/src/router.rs +++ b/crates/egui_router/src/router.rs @@ -29,7 +29,7 @@ pub struct EguiRouter { } impl EguiRouter { - /// Create a new [RouterBuilder] + /// Create a new [`RouterBuilder`] pub fn builder() -> RouterBuilder { RouterBuilder::new() } @@ -53,7 +53,12 @@ impl EguiRouter { .or(builder.default_route.map(|d| (d, None))) { router - .navigate_impl(state, r, TransitionConfig::none(), state_index.unwrap_or(0)) + .navigate_impl( + state, + &r, + TransitionConfig::none(), + state_index.unwrap_or(0), + ) .unwrap(); } @@ -74,11 +79,11 @@ impl EguiRouter { fn navigate_impl( &mut self, state: &mut State, - path: String, + path: &str, transition_config: TransitionConfig, new_state: u32, ) -> RouterResult { - let (path, query) = Self::parse_path(&path); + let (path, query) = Self::parse_path(path); let mut redirect = None; let result = self.router.at_mut(path); @@ -118,7 +123,7 @@ impl EguiRouter { if let Some(redirect) = redirect { self.history_kind.replace(&redirect, new_state)?; - self.navigate_impl(state, redirect, transition_config, new_state)?; + self.navigate_impl(state, &redirect, transition_config, new_state)?; } result @@ -132,10 +137,10 @@ impl EguiRouter { transition_config: TransitionConfig, ) -> RouterResult { let path = path.into(); - let current_state = self.history.last().map(|r| r.state).unwrap_or(0); + let current_state = self.history.last().map_or(0, |r| r.state); let new_state = current_state + 1; self.history_kind.push(&path, new_state)?; - self.navigate_impl(state, path.clone(), transition_config, new_state)?; + self.navigate_impl(state, &path, transition_config, new_state)?; Ok(()) } @@ -144,7 +149,7 @@ impl EguiRouter { self.navigate_transition(state, route, self.forward_transition.clone()) } - fn back_impl(&mut self, transition_config: TransitionConfig) -> RouterResult { + fn back_impl(&mut self, transition_config: TransitionConfig) { if self.history.len() > 1 { let leaving_route = self.history.pop(); self.current_transition = Some(CurrentTransition { @@ -153,13 +158,13 @@ impl EguiRouter { leaving_route, }); } - Ok(()) } /// Go back with a custom transition pub fn back_transition(&mut self, transition_config: TransitionConfig) -> RouterResult { self.history_kind.back()?; - self.back_impl(transition_config) + self.back_impl(transition_config); + Ok(()) } /// Go back with the default transition @@ -179,7 +184,7 @@ impl EguiRouter { let path = path.into(); let result = self.router.at_mut(&path); - let current_state = self.history.last().map(|r| r.state).unwrap_or(0); + let current_state = self.history.last().map_or(0, |r| r.state); let new_state = current_state; let (path, query) = Self::parse_path(&path); @@ -242,17 +247,17 @@ impl EguiRouter { .find(|r| r.path == path && r.state == state_index) .map(|r| r.state) { - let active_state = self.history.last().map(|r| r.state).unwrap_or(0); + let active_state = self.history.last().map_or(0, |r| r.state); // Retain all routes with a state less than or equal to the new state and the active state so that we can animate them out self.history .retain(|r| r.state <= route_state || r.state == active_state); if route_state < active_state { - self.back_impl(self.backward_transition.clone()).ok(); + self.back_impl(self.backward_transition.clone()); } } else { - self.navigate_impl(state, path, self.forward_transition.clone(), state_index) + self.navigate_impl(state, &path, self.forward_transition.clone(), state_index) .ok(); } } diff --git a/crates/egui_router/src/router_builder.rs b/crates/egui_router/src/router_builder.rs index 8702339..71e3609 100644 --- a/crates/egui_router/src/router_builder.rs +++ b/crates/egui_router/src/router_builder.rs @@ -8,7 +8,7 @@ pub(crate) type ErrorUi = Arc>; pub(crate) type LoadingUi = Arc>; -/// Builder to create a [EguiRouter] +/// Builder to create a [`EguiRouter`] pub struct RouterBuilder { pub(crate) router: matchit::Router>, pub(crate) default_route: Option, @@ -43,7 +43,7 @@ impl RouterBuilder { default_duration: None, history_kind: None, error_ui: Arc::new(Box::new(|ui, _, err| { - ui.label(format!("Error: {}", err)); + ui.label(format!("Error: {err}")); })), loading_ui: Arc::new(Box::new(|ui, _| { ui.spinner(); @@ -82,7 +82,7 @@ impl RouterBuilder { self } - /// Set the default route (when using [history::BrowserHistory], window.location.pathname will be used instead) + /// Set the default route (when using [`history::BrowserHistory`], window.location.pathname will be used instead) pub fn default_path(mut self, route: impl Into) -> Self { self.default_route = Some(route.into()); self @@ -112,7 +112,7 @@ impl RouterBuilder { } /// Add a route. Check the [matchit] documentation for information about the route syntax. - /// The handler will be called with [crate::Request] and should return a [Route]. + /// The handler will be called with [`crate::Request`] and should return a [Route]. /// /// # Example /// ```rust @@ -177,8 +177,6 @@ impl RouterBuilder { /// .async_route("/", my_handler) /// .async_route("/:post", my_fallible_handler) /// .build(&mut ()); - /// - /// #[cfg(feature = "async")] pub fn async_route(mut self, route: &str, handler: Han) -> Self where diff --git a/crates/egui_router/src/transition.rs b/crates/egui_router/src/transition.rs index 919574c..1c17ede 100644 --- a/crates/egui_router/src/transition.rs +++ b/crates/egui_router/src/transition.rs @@ -2,7 +2,7 @@ use crate::TransitionConfig; use egui::{Id, Ui, UiBuilder, Vec2}; /// Trait for declaring a transition. -/// Prefer [ComposableTransitionTrait] unless you need to create a new ui to apply the transition. +/// Prefer [`ComposableTransitionTrait`] unless you need to create a new ui to apply the transition. pub trait TransitionTrait { /// Create a child ui with the transition applied fn create_child_ui(&self, ui: &mut Ui, t: f32, with_id: Id) -> Ui; @@ -64,7 +64,7 @@ pub struct NoTransition; /// Slide transition #[derive(Debug, Clone)] pub struct SlideTransition { - /// Amount and direction to slide. Default is [Vec2::X] (so it will slide in from the right) + /// Amount and direction to slide. Default is [`Vec2::X`] (so it will slide in from the right) pub amount: Vec2, } @@ -79,7 +79,7 @@ impl Default for SlideTransition { } impl SlideTransition { - /// Create a new slide transition. Default is [Vec2::X] (so it will slide in from the right) + /// Create a new slide transition. Default is [`Vec2::X`] (so it will slide in from the right) pub fn new(amount: Vec2) -> Self { Self { amount } } @@ -149,14 +149,14 @@ pub enum TransitionType { /// Forward transition Forward { /// Will be applied to the page that is being navigated to - _in: Transition, + in_: Transition, /// Will be applied to the page that is being navigated from out: Transition, }, /// Backward transition (will play the out transition in reverse) Backward { /// Will be applied to the page that is being navigated to - _in: Transition, + in_: Transition, /// Will be applied to the page that is being navigated from out: Transition, }, @@ -166,7 +166,7 @@ pub(crate) struct ActiveTransition { duration: Option, progress: f32, easing: fn(f32) -> f32, - _in: Transition, + in_: Transition, out: Transition, backward: bool, } @@ -182,7 +182,7 @@ impl ActiveTransition { duration: config.duration, easing: config.easing, progress: 0.0, - _in: config._in, + in_: config.in_, out: config.out, backward: false, } @@ -193,7 +193,7 @@ impl ActiveTransition { duration: config.duration, easing: config.easing, progress: 0.0, - _in: config._in, + in_: config.in_, out: config.out, backward: true, } @@ -210,7 +210,7 @@ impl ActiveTransition { &mut self, ui: &mut Ui, state: &mut State, - (in_id, content_in): (usize, impl FnOnce(&mut Ui, &mut State)), + (in_id, contentin_): (usize, impl FnOnce(&mut Ui, &mut State)), content_out: Option<(usize, impl FnOnce(&mut Ui, &mut State))>, ) -> ActiveTransitionResult { let dt = ui.input(|i| i.stable_dt); @@ -220,39 +220,19 @@ impl ActiveTransition { let t = self.progress.min(1.0); ui.ctx().request_repaint(); - if !self.backward { - if let Some((out_id, content_out)) = content_out { - with_temp_auto_id(ui, out_id, |ui| { - let mut out_ui = self.out.create_child_ui( - ui, - (self.easing)(1.0 - t), - Id::new("router_child").with(out_id), - ); - content_out(&mut out_ui, state); - }); - } - - with_temp_auto_id(ui, in_id, |ui| { - let mut in_ui = self._in.create_child_ui( - ui, - (self.easing)(t), - Id::new("router_child").with(in_id), - ); - content_in(&mut in_ui, state); - }); - } else { + if self.backward { with_temp_auto_id(ui, in_id, |ui| { let mut out_ui = self.out.create_child_ui( ui, (self.easing)(t), Id::new("router_child").with(in_id), ); - content_in(&mut out_ui, state); + contentin_(&mut out_ui, state); }); if let Some((out_id, content_out)) = content_out { with_temp_auto_id(ui, out_id, |ui| { - let mut in_ui = self._in.create_child_ui( + let mut in_ui = self.in_.create_child_ui( ui, (self.easing)(1.0 - t), Id::new("router_child").with(out_id), @@ -260,6 +240,26 @@ impl ActiveTransition { content_out(&mut in_ui, state); }); } + } else { + if let Some((out_id, content_out)) = content_out { + with_temp_auto_id(ui, out_id, |ui| { + let mut out_ui = self.out.create_child_ui( + ui, + (self.easing)(1.0 - t), + Id::new("router_child").with(out_id), + ); + content_out(&mut out_ui, state); + }); + } + + with_temp_auto_id(ui, in_id, |ui| { + let mut in_ui = self.in_.create_child_ui( + ui, + (self.easing)(t), + Id::new("router_child").with(in_id), + ); + contentin_(&mut in_ui, state); + }); } if self.progress >= 1.0 { diff --git a/crates/egui_suspense/Cargo.toml b/crates/egui_suspense/Cargo.toml index f85072f..5ab82e0 100644 --- a/crates/egui_suspense/Cargo.toml +++ b/crates/egui_suspense/Cargo.toml @@ -29,3 +29,6 @@ rand = "0.8.5" reqwest = { version = "0.12.5", features = ["json"] } tokio = { version = "1", features = ["full"] } futures = "0.3" + +[lints] +workspace = true diff --git a/crates/egui_suspense/examples/async.rs b/crates/egui_suspense/examples/async.rs index b7c1669..268b94b 100644 --- a/crates/egui_suspense/examples/async.rs +++ b/crates/egui_suspense/examples/async.rs @@ -1,3 +1,4 @@ +use eframe::NativeOptions; use egui::CentralPanel; use egui_suspense::EguiSuspense; use futures::TryFutureExt; @@ -5,20 +6,20 @@ use futures::TryFutureExt; #[tokio::main] async fn main() -> eframe::Result<()> { let mut timezones: EguiSuspense, _> = EguiSuspense::reloadable_async(|| { - reqwest::get("https://worldtimeapi.org/api/timezone").and_then(|r| r.json()) + reqwest::get("https://worldtimeapi.org/api/timezone").and_then(reqwest::Response::json) }); let mut suspense = EguiSuspense::reloadable_async(|| { - reqwest::get("https://worldtimeapi.org/api/ip").and_then(|r| r.text()) + reqwest::get("https://worldtimeapi.org/api/ip").and_then(reqwest::Response::text) }); eframe::run_simple_native( "Suspense Async Example", - Default::default(), + NativeOptions::default(), move |ctx, _frame| { CentralPanel::default().show(ctx, |ui| { timezones.ui(ui, |ui, data, state| { - ui.label(format!("Timezones: {:?}", data)); + ui.label(format!("Timezones: {data:?}")); if ui.button("Reload").clicked() { state.reload(); } @@ -28,7 +29,7 @@ async fn main() -> eframe::Result<()> { if ui.button("Reload").clicked() { state.reload(); } - ui.label(format!("Data: {:?}", data)); + ui.label(format!("Data: {data:?}")); }); }); }, diff --git a/crates/egui_suspense/examples/customization.rs b/crates/egui_suspense/examples/customization.rs index 9a334cc..da8a708 100644 --- a/crates/egui_suspense/examples/customization.rs +++ b/crates/egui_suspense/examples/customization.rs @@ -1,6 +1,6 @@ use std::fmt::Debug; -use eframe::egui; +use eframe::{egui, NativeOptions}; use egui::{CentralPanel, Frame, Window}; use egui_suspense::EguiSuspense; @@ -27,7 +27,7 @@ pub fn main() -> eframe::Result<()> { eframe::run_simple_native( "Custom Suspense Example", - Default::default(), + NativeOptions::default(), move |ctx, _frame| { CentralPanel::default().show(ctx, |ui| { Window::new("Main Window").show(ui.ctx(), |ui| { @@ -52,7 +52,7 @@ pub fn main() -> eframe::Result<()> { suspenses.iter_mut().enumerate().for_each(|(i, suspense)| { Window::new(i.to_string()).show(ui.ctx(), |ui| { suspense.ui(ui, |ui, data, _state| { - ui.label(format!("Data: {:?}", data)); + ui.label(format!("Data: {data:?}")); }); }); }); diff --git a/crates/egui_suspense/examples/suspense.rs b/crates/egui_suspense/examples/suspense.rs index fbbe7f2..bfd6949 100644 --- a/crates/egui_suspense/examples/suspense.rs +++ b/crates/egui_suspense/examples/suspense.rs @@ -1,4 +1,4 @@ -use eframe::egui; +use eframe::{egui, NativeOptions}; use egui::{CentralPanel, Window}; use egui_suspense::EguiSuspense; @@ -8,7 +8,7 @@ pub fn main() -> eframe::Result<()> { eframe::run_simple_native( "Suspense Example", - Default::default(), + NativeOptions::default(), move |ctx, _frame| { CentralPanel::default().show(ctx, |ui| { Window::new("Main Window").show(ui.ctx(), |ui| { @@ -42,7 +42,7 @@ pub fn main() -> eframe::Result<()> { suspenses.iter_mut().enumerate().for_each(|(i, suspense)| { Window::new(i.to_string()).show(ui.ctx(), |ui| { suspense.ui(ui, |ui, data, _state| { - ui.label(format!("Data: {:?}", data)); + ui.label(format!("Data: {data:?}")); }); }); }); diff --git a/crates/egui_suspense/examples/suspense_minimal.rs b/crates/egui_suspense/examples/suspense_minimal.rs index 0c1b1a9..0f1d3e1 100644 --- a/crates/egui_suspense/examples/suspense_minimal.rs +++ b/crates/egui_suspense/examples/suspense_minimal.rs @@ -1,4 +1,4 @@ -use eframe::egui; +use eframe::{egui, NativeOptions}; use egui::CentralPanel; use egui_suspense::EguiSuspense; @@ -34,11 +34,11 @@ pub fn main() -> eframe::Result<()> { eframe::run_simple_native( "DnD Simple Example", - Default::default(), + NativeOptions::default(), move |ctx, _frame| { CentralPanel::default().show(ctx, |ui| { suspense.ui(ui, |ui, data, state| { - ui.label(format!("Data: {:?}", data)); + ui.label(format!("Data: {data:?}")); if ui.button("Reload").clicked() { state.reload(); @@ -48,13 +48,13 @@ pub fn main() -> eframe::Result<()> { ui.separator(); single_suspense.ui(ui, |ui, data, _state| { - ui.label(format!("Data: {:?}", data)); + ui.label(format!("Data: {data:?}")); }); ui.separator(); already_loaded_suspense.ui(ui, |ui, data, _state| { - ui.label(format!("Data: {:?}", data)); + ui.label(format!("Data: {data:?}")); }); }); }, diff --git a/crates/egui_suspense/src/lib.rs b/crates/egui_suspense/src/lib.rs index 0494d83..734e7a5 100644 --- a/crates/egui_suspense/src/lib.rs +++ b/crates/egui_suspense/src/lib.rs @@ -31,7 +31,7 @@ mod types { pub type ReloadFnRef<'a> = &'a mut (dyn FnMut() + Send + Sync); } -use types::*; +use types::{ErrorUiFn, LoadingUiFn, ReloadFn, ReloadFnRef}; /// Helper struct to call the reload function. pub struct State<'a> { @@ -262,7 +262,7 @@ impl bool { - self.data.as_ref().map(|r| r.is_err()).unwrap_or(false) + self.data + .as_ref() + .map_or(false, std::result::Result::is_err) } /// Returns the data if it is loaded. diff --git a/crates/egui_taffy/Cargo.toml b/crates/egui_taffy/Cargo.toml index 41952ed..1a219ba 100644 --- a/crates/egui_taffy/Cargo.toml +++ b/crates/egui_taffy/Cargo.toml @@ -17,3 +17,5 @@ eframe = { workspace = true, default-features = true } rand = "0.8.5" +[lints] +workspace = true diff --git a/crates/egui_taffy/examples/taffy.rs b/crates/egui_taffy/examples/taffy.rs index 2644d0d..0a6cccf 100644 --- a/crates/egui_taffy/examples/taffy.rs +++ b/crates/egui_taffy/examples/taffy.rs @@ -1,5 +1,6 @@ -use eframe::egui; +#![allow(clippy::too_many_lines)] // It's ok as it is an example use eframe::emath::Align; +use eframe::{egui, NativeOptions}; use egui::{CentralPanel, Color32, Direction, Frame, Id, Layout, Resize, ScrollArea, Ui}; use rand::prelude::SliceRandom; use taffy::prelude::{ @@ -20,7 +21,7 @@ const TEXTS: [&str; 5] = [ "flow nicely in yor layout", ]; pub fn main() -> eframe::Result<()> { - let buttons: Vec<_> = TEXTS.iter().map(|s| s.to_string()).collect(); + let buttons: Vec<_> = TEXTS.iter().map(std::string::ToString::to_string).collect(); let many_buttons = (0..100).fold(Vec::new(), |mut acc, _| { acc.push(buttons.choose(&mut rand::thread_rng()).unwrap().to_string()); @@ -29,7 +30,7 @@ pub fn main() -> eframe::Result<()> { eframe::run_simple_native( "DnD Simple Example", - Default::default(), + NativeOptions::default(), move |ctx, _frame| { CentralPanel::default().show(ctx, |ui| { ScrollArea::vertical().show(ui, |ui| { @@ -220,7 +221,7 @@ fn list_example(ui: &mut Ui) { }) .collect(); - let texts: Vec<_> = texts.iter().map(|text| text.as_str()).collect(); + let texts: Vec<_> = texts.iter().map(std::string::String::as_str).collect(); { let mut taffy = TaffyPass::new( @@ -241,7 +242,7 @@ fn list_example(ui: &mut Ui) { }, ); - texts.iter().for_each(|text| { + for text in &texts { taffy.add_children_with_ui( Style { display: Display::Flex, @@ -319,7 +320,7 @@ fn list_example(ui: &mut Ui) { } }, ); - }); + } taffy.show(); } diff --git a/crates/egui_taffy/src/lib.rs b/crates/egui_taffy/src/lib.rs index 480f945..ba69497 100644 --- a/crates/egui_taffy/src/lib.rs +++ b/crates/egui_taffy/src/lib.rs @@ -1,7 +1,7 @@ use std::collections::HashMap; use egui::util::IdTypeMap; -use egui::{Context, Id, LayerId, Order, Pos2, Ui, UiBuilder, UiStackInfo}; +use egui::{Context, Id, LayerId, Order, Pos2, RawInput, Ui, UiBuilder, UiStackInfo, Vec2}; use taffy::prelude::*; pub use taffy; @@ -67,7 +67,7 @@ pub struct TaffyPass<'a, 'f> { } impl<'a, 'f> TaffyPass<'a, 'f> { - fn with_state(id: Id, ctx: Context, f: impl FnOnce(&mut TaffyState) -> T) -> T { + fn with_state(id: Id, ctx: &Context, f: impl FnOnce(&mut TaffyState) -> T) -> T { ctx.data_mut(|data: &mut IdTypeMap| { let data = data.get_temp_mut_or_insert_with(id, TaffyState::new); @@ -76,13 +76,13 @@ impl<'a, 'f> TaffyPass<'a, 'f> { } pub fn new(ui: &'a mut Ui, id: Id, style: Style) -> Self { - let current_node = Self::with_state(id, ui.ctx().clone(), |state| { + let current_node = Self::with_state(id, ui.ctx(), |state| { state.begin_pass(style); state.root_node }); let measure_ctx = Context::default(); - let _ = measure_ctx.run(Default::default(), |_| {}); + let _ = measure_ctx.run(RawInput::default(), |_| {}); Self { id, @@ -116,7 +116,7 @@ impl<'a, 'f> TaffyPass<'a, 'f> { let previous_node = self.current_node; let previous_node_index = self.current_node_index; - Self::with_state(self.id, self.ui.ctx().clone(), |state| { + Self::with_state(self.id, self.ui.ctx(), |state| { let index = self.content_fns.len(); self.content_fns.push(content); @@ -161,7 +161,7 @@ impl<'a, 'f> TaffyPass<'a, 'f> { layout: egui::Layout, content: impl FnMut(&mut Ui) + 'f, ) { - Self::with_state(self.id, self.ui.ctx().clone(), |state| { + Self::with_state(self.id, self.ui.ctx(), |state| { let content_idx = self.content_fns.len(); self.content_fns.push(Some(Box::new(content))); @@ -203,6 +203,7 @@ impl<'a, 'f> TaffyPass<'a, 'f> { }); } + #[allow(clippy::too_many_lines)] // TODO: refactor this to reduce the number of lines pub fn show(mut self) { let ctx = self.measure_ctx.clone(); let (layouts, node) = self.ui.ctx().data_mut(|data: &mut IdTypeMap| { @@ -243,7 +244,7 @@ impl<'a, 'f> TaffyPass<'a, 'f> { }; let rect = egui::Rect::from_min_size( - Default::default(), + Pos2::default(), egui::Vec2::new( known_size.width.unwrap_or(available_width), known_size.height.unwrap_or(available_height), @@ -259,8 +260,8 @@ impl<'a, 'f> TaffyPass<'a, 'f> { .ui_stack_info(UiStackInfo::default()), ); ui.set_clip_rect(egui::Rect::from_min_size( - Default::default(), - Default::default(), + Pos2::default(), + Vec2::default(), )); let response = ui.with_layout( egui::Layout { diff --git a/crates/egui_thumbhash/Cargo.toml b/crates/egui_thumbhash/Cargo.toml index eb372a7..c716e85 100644 --- a/crates/egui_thumbhash/Cargo.toml +++ b/crates/egui_thumbhash/Cargo.toml @@ -16,9 +16,21 @@ base64 = "0.22.1" [dev-dependencies] eframe = { workspace = true, default-features = true } -egui_extras = { workspace = true, default-features = true, features = ["file", "image", "http"] } +egui_extras = { workspace = true, default-features = true, features = [ + "file", + "image", + "http", +] } -oxhttp = { version = "0.2.0", default-features = false, features = ["client", "rustls", "webpki-roots", "rustls-pki-types"] } +oxhttp = { version = "0.2.0", default-features = false, features = [ + "client", + "rustls", + "webpki-roots", + "rustls-pki-types", +] } serde = { version = "1", features = ["derive"] } serde_json = "1" image = "0.25.1" + +[lints] +workspace = true diff --git a/crates/egui_thumbhash/src/image.rs b/crates/egui_thumbhash/src/image.rs index 574e78f..e7f4323 100644 --- a/crates/egui_thumbhash/src/image.rs +++ b/crates/egui_thumbhash/src/image.rs @@ -1,6 +1,9 @@ use egui::epaint::RectShape; use egui::load::TexturePoll; -use egui::{Color32, Id, Image, Rect, Response, Rounding, SizeHint, TextureOptions, Ui, Widget}; +use egui::{ + Color32, Id, Image, Pos2, Rect, Response, Rounding, SizeHint, Stroke, TextureOptions, Ui, Vec2, + Widget, +}; use crate::thumbhash_to_uri; @@ -15,10 +18,10 @@ pub struct ThumbhashImage<'a, 'h> { } impl<'a, 'h> ThumbhashImage<'a, 'h> { - /// Create a new ThumbhashImage widget. + /// Create a new `ThumbhashImage` widget. /// You should pass a [Image] with the configuration you want. /// Since the width of the egui Image is currently a bit finicky, you can use - /// [Image::fit_to_exact_size] to make sure the image is the size you want. + /// [`Image::fit_to_exact_size`] to make sure the image is the size you want. pub fn new(image: Image<'a>, thumbhash: &'h [u8]) -> Self { Self { id: Id::new(thumbhash), @@ -52,7 +55,7 @@ impl<'a, 'h> ThumbhashImage<'a, 'h> { } /// Set the rounding of the image. - /// Use this instead of [Image::rounding] to make sure the rounding is applied to the + /// Use this instead of [`Image::rounding`] to make sure the rounding is applied to the /// thumbhash image as well. pub fn rounding(mut self, rounding: impl Into) -> Self { self.rounding = Some(rounding.into()); @@ -102,8 +105,8 @@ impl<'a, 'h> ThumbhashImage<'a, 'h> { rounding: self.rounding.unwrap_or_default(), fill_texture_id: texture.id, fill: Color32::from_rgba_premultiplied(i, i, i, i), - stroke: Default::default(), - uv: Rect::from_min_size(Default::default(), egui::Vec2::new(1.0, 1.0)), + stroke: Stroke::default(), + uv: Rect::from_min_size(Pos2::default(), Vec2::new(1.0, 1.0)), blur_width: 0.0, }); } diff --git a/crates/egui_thumbhash/src/lib.rs b/crates/egui_thumbhash/src/lib.rs index 897583f..017dccb 100644 --- a/crates/egui_thumbhash/src/lib.rs +++ b/crates/egui_thumbhash/src/lib.rs @@ -19,17 +19,17 @@ mod image; /// Register the thumbhash image loader with the given egui context. /// Do this once while the app is initializing. pub fn register(ctx: &Context) { - ctx.add_image_loader(Arc::new(ThumbhashImageLoader::new())) + ctx.add_image_loader(Arc::new(ThumbhashImageLoader::new())); } -/// The ImageLoader implementation for thumbhash images. +/// The `ImageLoader` implementation for thumbhash images. #[derive(Clone, Default)] pub struct ThumbhashImageLoader { images: Mutex>>, } impl ThumbhashImageLoader { - /// Create a new ThumbhashImageLoader. + /// Create a new `ThumbhashImageLoader`. pub fn new() -> Self { Self::default() } @@ -63,7 +63,7 @@ impl ImageLoader for ThumbhashImageLoader { images.insert(id, image.clone()); Ok(ImagePoll::Ready { image }) } - Err(_) => Err(LoadError::Loading("Invalid thumbhash".to_string())), + Err(()) => Err(LoadError::Loading("Invalid thumbhash".to_string())), } } } else { diff --git a/crates/egui_virtual_list/Cargo.toml b/crates/egui_virtual_list/Cargo.toml index 004f36d..19136d5 100644 --- a/crates/egui_virtual_list/Cargo.toml +++ b/crates/egui_virtual_list/Cargo.toml @@ -16,3 +16,6 @@ web-time = "1" [dev-dependencies] eframe = { workspace = true, default-features = true } rand = "0.8" + +[lints] +workspace = true diff --git a/crates/egui_virtual_list/examples/virtual_list.rs b/crates/egui_virtual_list/examples/virtual_list.rs index eb948ed..3eb1b13 100644 --- a/crates/egui_virtual_list/examples/virtual_list.rs +++ b/crates/egui_virtual_list/examples/virtual_list.rs @@ -1,18 +1,18 @@ -use eframe::egui; +use eframe::{egui, NativeOptions}; use egui::{CentralPanel, Frame, Margin, ScrollArea}; use egui_virtual_list::VirtualList; use rand::prelude::StdRng; use rand::{Rng, SeedableRng}; pub fn main() -> eframe::Result<()> { - let items: Vec<_> = (0..100000).collect(); + let items: Vec<_> = (0..100_000).collect(); // Since the list stores state that is expensive to calculate, we have to store it somewhere in our application. let mut virtual_list = VirtualList::new(); eframe::run_simple_native( "Virtual List Simple Example", - Default::default(), + NativeOptions::default(), move |ctx, _frame| { CentralPanel::default().show(ctx, |ui| { ScrollArea::vertical().show(ui, |ui| { @@ -29,7 +29,7 @@ pub fn main() -> eframe::Result<()> { .inner_margin(Margin::symmetric(16.0, 8.0 + height / 2.0)) .show(ui, |ui| { ui.set_width(ui.available_width()); - ui.label(format!("Item {}", item)); + ui.label(format!("Item {item}")); }); // Return the amount of items that were rendered this row, diff --git a/crates/egui_virtual_list/src/lib.rs b/crates/egui_virtual_list/src/lib.rs index 84ce6d0..416bd2c 100644 --- a/crates/egui_virtual_list/src/lib.rs +++ b/crates/egui_virtual_list/src/lib.rs @@ -64,7 +64,7 @@ impl Default for VirtualList { } impl VirtualList { - /// Create a new VirtualList + /// Create a new `VirtualList` pub fn new() -> Self { Self { previous_item_range: usize::MAX..usize::MAX, @@ -119,6 +119,7 @@ impl VirtualList { /// The layout closure gets called with the index of the first item that should be displayed. /// It should return the number of items that were displayed. + #[allow(clippy::too_many_lines)] // TODO: refactor this to reduce the number of lines pub fn ui_custom_layout( &mut self, ui: &mut Ui, @@ -224,8 +225,7 @@ impl VirtualList { let item_start_index = self .rows .get(row_start_index) - .map(|row| row.range.start) - .unwrap_or(0) + .map_or(0, |row| row.range.start) + index_offset; let mut current_item_index = item_start_index; @@ -285,23 +285,17 @@ impl VirtualList { let size_with_space = size; - self.average_row_size = Some( - self.average_row_size - .map(|size| { - (current_row as f32 * size + size_with_space) - / (current_row as f32 + 1.0) - }) - .unwrap_or(size), - ); - - self.average_items_per_row = Some( - self.average_items_per_row - .map(|avg_count| { - (current_row as f32 * avg_count + count as f32) - / (current_row as f32 + 1.0) - }) - .unwrap_or(count as f32), - ); + self.average_row_size = Some(self.average_row_size.map_or(size, |size| { + (current_row as f32 * size + size_with_space) / (current_row as f32 + 1.0) + })); + + self.average_items_per_row = Some(self.average_items_per_row.map_or( + count as f32, + |avg_count| { + (current_row as f32 * avg_count + count as f32) + / (current_row as f32 + 1.0) + }, + )); self.last_known_row_index = Some(current_row); } diff --git a/crates/egui_webview/Cargo.toml b/crates/egui_webview/Cargo.toml index 376a472..1ffe921 100644 --- a/crates/egui_webview/Cargo.toml +++ b/crates/egui_webview/Cargo.toml @@ -14,7 +14,7 @@ egui_inbox = { workspace = true } image = "0.25.1" base64 = "0.22.1" -egui_extras = { workspace = true, features = ["image", ] } +egui_extras = { workspace = true, features = ["image"] } serde = { version = "1.0.195", features = ["derive"] } serde_json = "1" log = "0.4.20" @@ -22,3 +22,6 @@ rgb = "0.8" [dev-dependencies] eframe = { workspace = true, default-features = true } + +[lints] +workspace = true diff --git a/crates/egui_webview/examples/native_text_field.rs b/crates/egui_webview/examples/native_text_field.rs index 1251699..8fee375 100644 --- a/crates/egui_webview/examples/native_text_field.rs +++ b/crates/egui_webview/examples/native_text_field.rs @@ -1,3 +1,4 @@ +use eframe::NativeOptions; use egui::{vec2, TextEdit, Widget, Window}; use egui_webview::native_text_field::{NativeTextField, TextFieldType}; @@ -6,47 +7,51 @@ use egui_webview::{init_webview, webview_end_frame}; pub fn main() -> eframe::Result<()> { let mut view = None; - eframe::run_simple_native("Dnd Example App", Default::default(), move |ctx, _frame| { - if view.is_none() { - init_webview(ctx); - - view = Some(( - NativeTextField::new(ctx, "email", TextFieldType::Email, _frame), - NativeTextField::new(ctx, "password", TextFieldType::Password, _frame), - NativeTextField::new(ctx, "textarea", TextFieldType::Textarea, _frame), - )); - } - - let view = view.as_mut().unwrap(); - - Window::new("Hello").show(ctx, |ui| { - ui.label("Email"); - view.0.ui(ui, vec2(ui.available_size().x, 20.0)); - - ui.add_space(8.0); - ui.label("Password"); - view.1.ui(ui, vec2(ui.available_size().x, 20.0)); + eframe::run_simple_native( + "Dnd Example App", + NativeOptions::default(), + move |ctx, frame| { + if view.is_none() { + init_webview(ctx); + + view = Some(( + NativeTextField::new(ctx, "email", TextFieldType::Email, frame), + NativeTextField::new(ctx, "password", TextFieldType::Password, frame), + NativeTextField::new(ctx, "textarea", TextFieldType::Textarea, frame), + )); + } + + let view = view.as_mut().unwrap(); + + Window::new("Hello").show(ctx, |ui| { + ui.label("Email"); + view.0.ui(ui, vec2(ui.available_size().x, 20.0)); + + ui.add_space(8.0); + ui.label("Password"); + view.1.ui(ui, vec2(ui.available_size().x, 20.0)); + + ui.add_space(8.0); + ui.label("Textarea"); + view.2.ui(ui, vec2(ui.available_size().x, 100.0)); + }); - ui.add_space(8.0); - ui.label("Textarea"); - view.2.ui(ui, vec2(ui.available_size().x, 100.0)); - }); + Window::new("Hello 2").show(ctx, |ui| { + ui.label("Email"); + view.0 + .current_text_mut(|text| ui.text_edit_singleline(text).changed()); - Window::new("Hello 2").show(ctx, |ui| { - ui.label("Email"); - view.0 - .current_text_mut(|text| ui.text_edit_singleline(text).changed()); + ui.label("Password"); + view.1.current_text_mut(|text| { + TextEdit::singleline(text).password(true).ui(ui).changed() + }); - ui.label("Password"); - view.1.current_text_mut(|text| { - TextEdit::singleline(text).password(true).ui(ui).changed() + ui.label("Textarea"); + view.2 + .current_text_mut(|text| TextEdit::multiline(text).ui(ui).changed()); }); - ui.label("Textarea"); - view.2 - .current_text_mut(|text| TextEdit::multiline(text).ui(ui).changed()); - }); - - webview_end_frame(ctx); - }) + webview_end_frame(ctx); + }, + ) } diff --git a/crates/egui_webview/examples/webview.rs b/crates/egui_webview/examples/webview.rs index 7a5c375..3224beb 100644 --- a/crates/egui_webview/examples/webview.rs +++ b/crates/egui_webview/examples/webview.rs @@ -1,4 +1,4 @@ -use eframe::emath::Align; +use eframe::{emath::Align, NativeOptions}; use egui::{ popup_above_or_below_widget, AboveOrBelow, CentralPanel, Context, Id, Layout, PopupCloseBehavior, TextEdit, Widget, Window, @@ -14,8 +14,8 @@ pub struct WebBrowser { } impl WebBrowser { - pub fn new(ctx: Context, id: Id, url: &str, window: &impl HasWindowHandle) -> Self { - let view = EguiWebView::new(&ctx, id, window, |b| b.with_url(url)); + pub fn new(ctx: &Context, id: Id, url: &str, window: &impl HasWindowHandle) -> Self { + let view = EguiWebView::new(ctx, id, window, |b| b.with_url(url)); Self { id, @@ -112,27 +112,31 @@ pub fn main() -> eframe::Result<()> { let mut count = 0; - eframe::run_simple_native("Dnd Example App", Default::default(), move |ctx, _frame| { - egui_extras::install_image_loaders(ctx); - - CentralPanel::default().show(ctx, |ui| { - if windows.is_empty() || ui.button("New Window").clicked() { - init_webview(ctx); - - let url = default_urls[count % default_urls.len()]; - - windows.push(WebBrowser::new( - ctx.clone(), - Id::new(format!("Window {}", count)), - url, - _frame, - )); - count += 1; - } - }); + eframe::run_simple_native( + "Dnd Example App", + NativeOptions::default(), + move |ctx, frame| { + egui_extras::install_image_loaders(ctx); + + CentralPanel::default().show(ctx, |ui| { + if windows.is_empty() || ui.button("New Window").clicked() { + init_webview(ctx); + + let url = default_urls[count % default_urls.len()]; + + windows.push(WebBrowser::new( + ctx, + Id::new(format!("Window {count}")), + url, + frame, + )); + count += 1; + } + }); - windows.retain_mut(|w| w.ui(ctx)); + windows.retain_mut(|w| w.ui(ctx)); - webview_end_frame(ctx); - }) + webview_end_frame(ctx); + }, + ) } diff --git a/crates/egui_webview/src/lib.rs b/crates/egui_webview/src/lib.rs index 15efa26..ad9ab97 100644 --- a/crates/egui_webview/src/lib.rs +++ b/crates/egui_webview/src/lib.rs @@ -104,7 +104,7 @@ impl EguiWebView { let guard = view_ref_weak.lock(); if let Some(view) = guard.as_ref() { if let Err(err) = view.evaluate_script(include_str!("webview.js")) { - println!("Error loading webview script: {}", err); + println!("Error loading webview script: {err}"); }; } } @@ -115,14 +115,7 @@ impl EguiWebView { }) .with_ipc_handler(move |msg| { let result = Self::handle_js_event(msg.into_body(), &ctx_clone); - match result { - Ok(event) => { - tx.send(event).ok(); - } - Err(err) => { - println!("Error handling js event: {}", err); - } - } + tx.send(result).ok(); }); #[allow(clippy::arc_with_non_send_sync)] @@ -148,17 +141,17 @@ impl EguiWebView { } } - fn handle_js_event(msg: String, _ctx: &Context) -> Result> { + fn handle_js_event(msg: String, _ctx: &Context) -> WebViewEvent { let event = serde_json::from_str::(&msg).map(|e| e.event); match event { - Ok(JsEventType::Focus) => Ok(WebViewEvent::Focus), - Ok(JsEventType::Blur) => Ok(WebViewEvent::Blur), - Err(_) => Ok(WebViewEvent::Ipc(msg)), + Ok(JsEventType::Focus) => WebViewEvent::Focus, + Ok(JsEventType::Blur) => WebViewEvent::Blur, + Err(_) => WebViewEvent::Ipc(msg), } } - fn take_screenshot(&mut self) { + fn take_screenshot() { // let ctx = self.context.clone(); // let tx = self.inbox.sender(); @@ -186,10 +179,11 @@ impl EguiWebView { // .ok(); } + #[allow(clippy::needless_pass_by_value)] fn send_command(&self, command: PageCommand) -> Result<(), Box> { let json = serde_json::to_string(&command)?; self.view - .evaluate_script(&format!("__egui_webview_handle_command({})", json))?; + .evaluate_script(&format!("__egui_webview_handle_command({json})"))?; Ok(()) } @@ -216,10 +210,7 @@ impl EguiWebView { WebViewEvent::Focus => { ui.memory_mut(|mem| mem.request_focus(response.id)); } - WebViewEvent::Blur => {} - WebViewEvent::Loaded(_) => {} - WebViewEvent::Loading(_) => {} - WebViewEvent::Ipc(_) => {} + _ => {} }) .collect(); @@ -261,7 +252,7 @@ impl EguiWebView { if !should_display && self.displayed_last_frame { self.current_image = None; - self.take_screenshot(); + Self::take_screenshot(); } self.displayed_last_frame = should_display; @@ -280,12 +271,12 @@ impl EguiWebView { self.view .set_bounds(wry::Rect { position: Position::Logical(LogicalPosition::new( - wv_rect.min.x as f64, - wv_rect.min.y as f64, + f64::from(wv_rect.min.x), + f64::from(wv_rect.min.y), )), size: Size::Logical(LogicalSize::new( - wv_rect.width() as f64, - wv_rect.height() as f64, + f64::from(wv_rect.width()), + f64::from(wv_rect.height()), )), }) .unwrap(); @@ -312,7 +303,9 @@ struct GlobalWebViewState { rendered_this_frame: HashSet, } +#[allow(unsafe_code)] unsafe impl Send for GlobalWebViewState {} +#[allow(unsafe_code)] unsafe impl Sync for GlobalWebViewState {} pub const WEBVIEW_ID: &str = "egui_webview"; @@ -332,7 +325,7 @@ pub fn init_webview(ctx: &Context) { rendered_this_frame: HashSet::new(), views: HashMap::new(), }, - ) + ); }); } @@ -344,12 +337,12 @@ pub fn webview_end_frame(ctx: &Context) { ); state.views.retain(|id, view| { if let Some(view) = view.upgrade() { - if !state.rendered_this_frame.contains(id) { - println!("Set visible false"); - view.set_visible(false).ok(); - } else { + if state.rendered_this_frame.contains(id) { println!("Set visible true"); view.set_visible(true).ok(); + } else { + println!("Set visible false"); + view.set_visible(false).ok(); } true diff --git a/crates/egui_webview/src/native_text_field.rs b/crates/egui_webview/src/native_text_field.rs index c4a9084..f23294d 100644 --- a/crates/egui_webview/src/native_text_field.rs +++ b/crates/egui_webview/src/native_text_field.rs @@ -39,7 +39,9 @@ pub struct NativeTextField { field_type: TextFieldType, } +#[allow(unsafe_code)] unsafe impl Send for NativeTextField {} +#[allow(unsafe_code)] unsafe impl Sync for NativeTextField {} #[derive(Debug, Serialize, Deserialize)] @@ -66,7 +68,7 @@ impl NativeTextField { }); NativeTextField { webview: view, - current_text: "".to_string(), + current_text: String::new(), field_type: text_field_type, } } @@ -119,11 +121,11 @@ impl NativeTextField { pub fn current_text_mut(&mut self, f: impl FnOnce(&mut String) -> bool) { if f(&mut self.current_text) { - self.set_text(self.current_text.clone()); + self.set_text(&self.current_text); } } - pub fn set_text(&self, text: String) { + pub fn set_text(&self, text: &str) { self.webview .view .evaluate_script(&format!("set_text(\"{}\")", text.replace('\"', "\\\""))) diff --git a/crates/hello_egui_utils/Cargo.toml b/crates/hello_egui_utils/Cargo.toml index 9115acf..46136df 100644 --- a/crates/hello_egui_utils/Cargo.toml +++ b/crates/hello_egui_utils/Cargo.toml @@ -22,3 +22,6 @@ wasm-bindgen-futures = { version = "0.4", optional = true } [features] async = ["dep:wasm-bindgen-futures"] tokio = ["async", "dep:tokio"] + +[lints] +workspace = true diff --git a/crates/perfect_cursors/Cargo.toml b/crates/perfect_cursors/Cargo.toml index 4438041..0bbea90 100644 --- a/crates/perfect_cursors/Cargo.toml +++ b/crates/perfect_cursors/Cargo.toml @@ -14,3 +14,6 @@ web-time = "1" [dev-dependencies] eframe = { workspace = true, default-features = true } + +[lints] +workspace = true diff --git a/crates/perfect_cursors/examples/perfect_cursors_egui.rs b/crates/perfect_cursors/examples/perfect_cursors_egui.rs index 97629a2..16c0e41 100644 --- a/crates/perfect_cursors/examples/perfect_cursors_egui.rs +++ b/crates/perfect_cursors/examples/perfect_cursors_egui.rs @@ -59,7 +59,7 @@ pub fn main() -> eframe::Result<()> { ui.checkbox(&mut use_perfect_cursors, "Use Perfect Cursors"); }); - cursors.iter_mut().for_each(|cursor| { + for cursor in &mut cursors { if cursor.last_time.elapsed() > cursor.delay { cursor.last_time = Instant::now(); @@ -86,11 +86,11 @@ pub fn main() -> eframe::Result<()> { cursor.last_point = Some(pos); } } - }); + } for cursor in &mut cursors { let current_pos = if use_perfect_cursors { - cursor.cursor.tick().map(|p| p.into()) + cursor.cursor.tick().map(std::convert::Into::into) } else { cursor.received_point }; diff --git a/crates/perfect_cursors/src/lib.rs b/crates/perfect_cursors/src/lib.rs index b5d5967..07e3c2f 100644 --- a/crates/perfect_cursors/src/lib.rs +++ b/crates/perfect_cursors/src/lib.rs @@ -55,7 +55,7 @@ impl PerfectCursor { } pub fn add_point(&mut self, point: (f32, f32)) { - if Some(point) == self.prev_point.map(|p| p.into_tuple()) { + if Some(point) == self.prev_point.map(spline::Vec2::into_tuple) { return; } let point = Vec2::new(point.0, point.1); @@ -72,7 +72,7 @@ impl PerfectCursor { } if self.state == AnimationState::Stopped { - if self.prev_point.unwrap().dist(&point) < 4.0 { + if self.prev_point.unwrap().dist(point) < 4.0 { self.current_point = Some(point); return; } @@ -115,7 +115,7 @@ impl PerfectCursor { AnimationState::Animating { ref mut queue, .. } => { queue.push(animation); } - _ => {} + AnimationState::Stopped => {} } } @@ -123,14 +123,14 @@ impl PerfectCursor { let mut set_state = None; let result = match &mut self.state { - AnimationState::Stopped => self.current_point.map(|p| p.into_tuple()), - AnimationState::Idle => self.current_point.map(|p| p.into_tuple()), + AnimationState::Stopped | AnimationState::Idle => { + self.current_point.map(spline::Vec2::into_tuple) + } AnimationState::Animating { current, queue } => { let start_time = current .start_time .get_or_insert_with(web_time::Instant::now); - let t = (web_time::Instant::now() - *start_time).as_secs_f32() - / current.duration.as_secs_f32(); + let t = (*start_time).elapsed().as_secs_f32() / current.duration.as_secs_f32(); let point = self.spline.get_spline_point(t + current.start as f32); diff --git a/crates/perfect_cursors/src/spline.rs b/crates/perfect_cursors/src/spline.rs index ec10385..941dd73 100644 --- a/crates/perfect_cursors/src/spline.rs +++ b/crates/perfect_cursors/src/spline.rs @@ -9,7 +9,7 @@ impl Vec2 { Self { x, y } } - pub fn dist(&self, other: &Vec2) -> f32 { + pub fn dist(self, other: Vec2) -> f32 { ((self.x - other.x).powi(2) + (self.y - other.y).powi(2)).sqrt() } @@ -32,7 +32,7 @@ impl Spline { let mut total_length = 0.0; for (i, point) in points.iter().enumerate() { if i > 0 { - let length = point.dist(&points[i - 1]); + let length = point.dist(points[i - 1]); lengths.push(length); total_length += length; } @@ -47,7 +47,7 @@ impl Spline { pub fn add_point(&mut self, point: Vec2) { if let Some(prev) = self.prev { - let length = point.dist(&prev); + let length = point.dist(prev); self.lengths.push(length); self.total_length += length; self.points.push(point); diff --git a/fancy-example/Cargo.toml b/fancy-example/Cargo.toml index 6c15c8b..a8e4ebd 100644 --- a/fancy-example/Cargo.toml +++ b/fancy-example/Cargo.toml @@ -48,3 +48,6 @@ ureq = "2" [target.'cfg(target_arch = "wasm32")'.dependencies] wasm-bindgen-futures = "0.4.39" gloo-timers = { version = "0.3.0", features = ["futures"] } + +[lints] +workspace = true diff --git a/fancy-example/src/chat.rs b/fancy-example/src/chat.rs index dce7cb1..b65c8cf 100644 --- a/fancy-example/src/chat.rs +++ b/fancy-example/src/chat.rs @@ -148,6 +148,7 @@ impl ChatExample { } } + #[allow(clippy::too_many_lines)] // It's an example pub fn ui(&mut self, ui: &mut Ui, shared_state: &SharedState) { if !self.shown { self.shown = true; @@ -278,25 +279,25 @@ impl ChatExample { }) .response; - let points = if !is_message_from_myself { - let top = response.rect.left_top() + Vec2::splat(margin); + let points = if is_message_from_myself { + let top = response.rect.right_top() + Vec2::new(-margin, margin); let arrow_rect = - Rect::from_two_pos(top, top + Vec2::new(-rounding, rounding)); + Rect::from_two_pos(top, top + Vec2::new(rounding, rounding)); vec![ arrow_rect.left_top(), arrow_rect.right_top(), - arrow_rect.right_bottom(), + arrow_rect.left_bottom(), ] } else { - let top = response.rect.right_top() + Vec2::new(-margin, margin); + let top = response.rect.left_top() + Vec2::splat(margin); let arrow_rect = - Rect::from_two_pos(top, top + Vec2::new(rounding, rounding)); + Rect::from_two_pos(top, top + Vec2::new(-rounding, rounding)); vec![ arrow_rect.left_top(), arrow_rect.right_top(), - arrow_rect.left_bottom(), + arrow_rect.right_bottom(), ] }; @@ -351,6 +352,6 @@ impl ChatExample { impl ExampleTrait for ChatExample { fn ui(&mut self, ui: &mut Ui, shared_state: &mut SharedState) { - self.ui(ui, shared_state) + self.ui(ui, shared_state); } } diff --git a/fancy-example/src/color_sort.rs b/fancy-example/src/color_sort.rs index 71e158d..8631273 100644 --- a/fancy-example/src/color_sort.rs +++ b/fancy-example/src/color_sort.rs @@ -24,6 +24,7 @@ pub const COLOR_SORT_WRAPPED_EXAMPLE: Example = Example { #[derive(Clone)] pub struct Color { + #[allow(clippy::struct_field_names)] pub color: Color32, pub name: &'static str, pub rounded: bool, @@ -32,7 +33,7 @@ pub struct Color { impl Hash for Color { fn hash(&self, state: &mut H) { - self.index.hash(state) + self.index.hash(state); } } @@ -112,7 +113,7 @@ impl ColorSort { }); }); }) - }) + }); }); }); diff --git a/fancy-example/src/crate_ui.rs b/fancy-example/src/crate_ui.rs index 356eda5..ad5dcd1 100644 --- a/fancy-example/src/crate_ui.rs +++ b/fancy-example/src/crate_ui.rs @@ -2,7 +2,10 @@ use casey::snake; use egui::{Button, ScrollArea, Ui, Widget}; use egui_commonmark::{CommonMarkCache, CommonMarkViewer}; -use Crate::*; +use Crate::{ + EguiAnimation, EguiDnd, EguiForm, EguiInbox, EguiInfiniteScroll, EguiPullToRefresh, EguiRouter, + EguiSuspense, EguiThumbhash, EguiVirtualList, +}; use crate::shared_state::SharedState; use crate::{demo_area, FancyMessage}; @@ -76,7 +79,7 @@ crate_impl!( ); impl Crate { - pub fn short_name(&self) -> &'static str { + pub fn short_name(self) -> &'static str { if let Some(name) = self.name().strip_prefix("egui_") { name } else { @@ -84,7 +87,7 @@ impl Crate { } } - pub fn short_description(&self) -> &'static str { + pub fn short_description(self) -> &'static str { match self { EguiAnimation => "Animation utilities for egui", EguiDnd => "Drag and drop sorting for egui", @@ -193,7 +196,7 @@ impl CrateUi { } } - pub fn ui(&mut self, ui: &mut Ui, item: &Crate) { + pub fn ui(&mut self, ui: &mut Ui, item: Crate) { demo_area(ui, item.name(), 1000.0, |ui| { ScrollArea::vertical().show(ui, |ui| { ui.horizontal_wrapped(|ui| { @@ -206,8 +209,7 @@ impl CrateUi { let readme_split = readme .split_once(README_CONTENT_SEPARATOR) - .map(|(_, a)| a) - .unwrap_or(readme); + .map_or(readme, |(_, a)| a); // TODO: Find a better solution or cache string let readme_split = readme_split.replace(" no_run", ""); diff --git a/fancy-example/src/gallery.rs b/fancy-example/src/gallery.rs index 0f6349d..40b34a3 100644 --- a/fancy-example/src/gallery.rs +++ b/fancy-example/src/gallery.rs @@ -57,7 +57,7 @@ impl Gallery { } impl ExampleTrait for Gallery { - fn ui(&mut self, ui: &mut Ui, _shared_state: &mut SharedState) { + fn ui(&mut self, ui: &mut Ui, shared_state: &mut SharedState) { demo_area(ui, "Gallery", 1000.0, |ui| { let height = 300.0; @@ -88,7 +88,7 @@ impl ExampleTrait for Gallery { let total_width = ui.available_width(); let mut count = 1; - let mut combined_width = item.first().map(|item| item.width).unwrap_or(0.0); + let mut combined_width = item.first().map_or(0.0, |item| item.width); while combined_width < total_width - item_spacing * (count - 1) as f32 && count < item.len() @@ -145,7 +145,7 @@ impl ExampleTrait for Gallery { ui.add_space(8.0); - crate_usage_ui(ui, GALLERY_EXAMPLE.crates, _shared_state); + crate_usage_ui(ui, GALLERY_EXAMPLE.crates, shared_state); }); } } diff --git a/fancy-example/src/main.rs b/fancy-example/src/main.rs index d13f52a..a4dab7d 100644 --- a/fancy-example/src/main.rs +++ b/fancy-example/src/main.rs @@ -30,7 +30,6 @@ pub enum FancyMessage { } pub struct App { - sidebar: SideBar, sidebar_expanded: bool, shared_state: SharedState, inbox: UiInbox, @@ -51,7 +50,6 @@ impl App { let router = router(&mut state); Self { inbox, - sidebar: SideBar::new(), shared_state: state, sidebar_expanded: false, router, @@ -76,7 +74,7 @@ impl eframe::App for App { .resizable(false) .exact_width(170.0) .show_animated(ctx, is_expanded, |ui| { - if self.sidebar.ui(ui, &mut self.shared_state) { + if SideBar::ui(ui, &mut self.shared_state) { self.sidebar_expanded = false; } }); @@ -133,6 +131,8 @@ pub fn demo_area(ui: &mut Ui, title: &'static str, width: f32, content: impl FnO #[cfg(not(target_arch = "wasm32"))] fn main() -> eframe::Result<()> { + use eframe::NativeOptions; + let rt = tokio::runtime::Builder::new_current_thread() .enable_all() .build() @@ -148,12 +148,12 @@ fn main() -> eframe::Result<()> { loop { tokio::time::sleep(std::time::Duration::from_secs(3600)).await; } - }) + }); }); eframe::run_native( "Dnd Example App", - Default::default(), + NativeOptions::default(), Box::new(move |ctx| { egui_extras::install_image_loaders(&ctx.egui_ctx); egui_thumbhash::register(&ctx.egui_ctx); @@ -187,7 +187,7 @@ struct Gradient(pub Vec); // taken from the egui demo fn vertex_gradient(ui: &mut Ui, gradient: &Gradient) { - use egui::epaint::*; + use egui::epaint::{pos2, Mesh, Shape}; let rect = ui.max_rect(); @@ -218,11 +218,11 @@ fn vertex_gradient(ui: &mut Ui, gradient: &Gradient) { fn animate_color(ui: &mut Ui, color: Color32, id: Id, duration: f32) -> Color32 { Color32::from_rgba_premultiplied( ui.ctx() - .animate_value_with_time(id.with(0), color[0] as f32, duration) as u8, + .animate_value_with_time(id.with(0), f32::from(color[0]), duration) as u8, ui.ctx() - .animate_value_with_time(id.with(1), color[1] as f32, duration) as u8, + .animate_value_with_time(id.with(1), f32::from(color[1]), duration) as u8, ui.ctx() - .animate_value_with_time(id.with(2), color[2] as f32, duration) as u8, + .animate_value_with_time(id.with(2), f32::from(color[2]), duration) as u8, color[3], ) } diff --git a/fancy-example/src/routes.rs b/fancy-example/src/routes.rs index 3785cec..750eb65 100644 --- a/fancy-example/src/routes.rs +++ b/fancy-example/src/routes.rs @@ -1,3 +1,4 @@ +#![allow(clippy::needless_pass_by_value)] use crate::crate_ui::{CrateUi, ALL_CRATES}; use crate::example::EXAMPLES; use crate::shared_state::SharedState; @@ -30,7 +31,7 @@ pub fn crate_route(req: Request) -> impl Route { let mut crate_ui = CrateUi::new(); move |ui: &mut Ui, _state: &mut SharedState| { - crate_ui.ui(ui, item); + crate_ui.ui(ui, *item); } } diff --git a/fancy-example/src/sidebar.rs b/fancy-example/src/sidebar.rs index 8e02d8c..2b1fbef 100644 --- a/fancy-example/src/sidebar.rs +++ b/fancy-example/src/sidebar.rs @@ -8,11 +8,7 @@ use egui_flex::{Flex, FlexItem}; pub struct SideBar {} impl SideBar { - pub fn new() -> Self { - Self {} - } - - pub fn ui(&mut self, ui: &mut Ui, shared: &mut SharedState) -> bool { + pub fn ui(ui: &mut Ui, shared: &mut SharedState) -> bool { let mut clicked = false; ui.with_layout(Layout::top_down_justified(Align::Min), |ui| { ui.add_space(4.0); @@ -24,9 +20,9 @@ impl SideBar { ui.spacing_mut().button_padding = egui::vec2(6.0, 4.0); - for category in EXAMPLES.iter() { + for category in EXAMPLES { ui.small(category.name); - for example in category.examples.iter() { + for example in category.examples { let route = format!("/example/{}", example.slug); if ui .selectable_label( @@ -52,7 +48,7 @@ impl SideBar { ui.spacing_mut().item_spacing = Vec2::splat(8.0); Flex::horizontal().grow_items(1.0).show(ui, |flex| { - for item in ALL_CRATES.iter() { + for item in ALL_CRATES { let route = format!("/crate/{}", item.name()); let selected = shared.active_route == route; diff --git a/fancy-example/src/signup_form.rs b/fancy-example/src/signup_form.rs index d284d29..736a3c1 100644 --- a/fancy-example/src/signup_form.rs +++ b/fancy-example/src/signup_form.rs @@ -18,13 +18,13 @@ pub const SIGNUP_FORM_EXAMPLE: Example = Example { }; fn validate_password(password: &str) -> Result<(), ValidationError> { - if password.chars().all(|c| c.is_alphanumeric()) { + if password.chars().all(char::is_alphanumeric) { return Err(ValidationError::new("validate_password")); } - if password.chars().all(|c| c.is_lowercase()) { + if password.chars().all(char::is_lowercase) { return Err(ValidationError::new("validate_password")); } - if password.chars().all(|c| c.is_uppercase()) { + if password.chars().all(char::is_uppercase) { return Err(ValidationError::new("validate_password")); } if password.chars().all(|c| !c.is_ascii_digit()) { @@ -41,10 +41,10 @@ fn validate_repeat_password( repeat_password: &str, context: &ValidateContext, ) -> Result<(), ValidationError> { - if repeat_password != context.password { - Err(ValidationError::new("password_mismatch")) - } else { + if repeat_password == context.password { Ok(()) + } else { + Err(ValidationError::new("password_mismatch")) } } @@ -91,6 +91,7 @@ fn text_edit_singleline(value: &mut String) -> TextEdit { } impl ExampleTrait for SignupForm { + #[allow(clippy::too_many_lines)] // It's an example fn ui(&mut self, ui: &mut Ui, shared_state: &mut SharedState) { demo_area(ui, SIGNUP_FORM_EXAMPLE.name, 400.0, |ui| { ScrollArea::vertical().show(ui, |ui| { @@ -119,14 +120,14 @@ impl ExampleTrait for SignupForm { match error.code.as_ref() { "length" => match (error.params.get("min"), error.params.get("max")) { (Some(min), Some(max)) => { - format!("Must be between {} and {} characters long", min, max) + format!("Must be between {min} and {max} characters long") .into() } (Some(min), None) => { - format!("Must be at least {} characters long", min).into() + format!("Must be at least {min} characters long").into() } (None, Some(max)) => { - format!("Must be at most {} characters long", max).into() + format!("Must be at most {max} characters long").into() } _ => "Invalid length".into(), }, @@ -163,10 +164,10 @@ impl ExampleTrait for SignupForm { let max_width = ui.available_width(); ui.label( - r#"This is a example signup form showcasing egui_form's form validation. + r"This is a example signup form showcasing egui_form's form validation. Try signing up with invalid data to see the validation errors. Errors will show up after editing a field or after trying to submit. - "#, + ", ); let horizontal_fields = From a7e9ae905ac22862d421cd079a01a4d85db59354 Mon Sep 17 00:00:00 2001 From: Nicolas Date: Fri, 27 Sep 2024 00:03:10 +0200 Subject: [PATCH 12/16] update crates --- Cargo.lock | 778 +++++++++--------- Cargo.toml | 20 +- crates/egui_form/Cargo.toml | 4 +- .../egui_form/examples/egui_form_minimal.rs | 4 +- crates/egui_form/examples/garde.rs | 6 +- crates/egui_form/src/garde.rs | 8 +- crates/egui_form/src/lib.rs | 4 +- crates/egui_inbox/Cargo.toml | 2 +- crates/egui_inbox/examples/broadcast.rs | 2 +- crates/egui_inbox/examples/inbox_spawn.rs | 71 +- crates/egui_inbox/examples/router_login.rs | 20 +- crates/egui_inbox/src/broadcast.rs | 11 +- crates/egui_inbox/src/lib.rs | 6 +- crates/egui_inbox/src/type_broadcast.rs | 14 +- .../examples/infinite_scroll_async.rs | 6 +- .../examples/infinite_scroll_table.rs | 6 +- crates/egui_infinite_scroll/src/lib.rs | 2 +- crates/egui_router/examples/async_router.rs | 4 +- crates/egui_router/examples/router.rs | 8 +- crates/egui_router/src/lib.rs | 2 +- crates/egui_router/src/router_builder.rs | 2 +- crates/egui_suspense/Cargo.toml | 2 +- crates/egui_taffy/Cargo.toml | 2 +- crates/egui_thumbhash/Cargo.toml | 4 +- crates/egui_webview/Cargo.toml | 8 +- fancy-example/Cargo.toml | 8 +- 26 files changed, 520 insertions(+), 484 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 142141c..e1153ae 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -103,7 +103,7 @@ dependencies = [ "accesskit_macos", "accesskit_unix", "accesskit_windows", - "raw-window-handle 0.6.2", + "raw-window-handle", "winit", ] @@ -122,6 +122,12 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "adler2" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" + [[package]] name = "ahash" version = "0.8.11" @@ -170,10 +176,10 @@ dependencies = [ "jni-sys", "libc", "log", - "ndk 0.9.0", + "ndk", "ndk-context", "ndk-sys 0.6.0+11769913", - "num_enum 0.7.2", + "num_enum", "thiserror", ] @@ -194,9 +200,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.86" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" +checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6" [[package]] name = "arbitrary" @@ -227,7 +233,7 @@ checksum = "0ae92a5119aa49cdbcf6b9f893fe4e1d98b04ccbf82ee0584ad948a44a734dea" dependencies = [ "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.77", ] [[package]] @@ -238,9 +244,9 @@ checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" [[package]] name = "arrayvec" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "as-raw-xcb-connection" @@ -287,7 +293,7 @@ checksum = "c8828ec6e544c02b0d6691d21ed9f9218d0384a82542855073c2a3f58304aaf0" dependencies = [ "async-task", "concurrent-queue", - "fastrand 2.1.0", + "fastrand 2.1.1", "futures-lite 2.3.0", "slab", ] @@ -337,7 +343,7 @@ dependencies = [ "futures-lite 2.3.0", "parking", "polling 3.7.2", - "rustix 0.38.34", + "rustix 0.38.37", "slab", "tracing", "windows-sys 0.52.0", @@ -376,7 +382,7 @@ dependencies = [ "cfg-if", "event-listener 3.1.0", "futures-lite 1.13.0", - "rustix 0.38.34", + "rustix 0.38.37", "windows-sys 0.48.0", ] @@ -388,7 +394,7 @@ checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11" dependencies = [ "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.77", ] [[package]] @@ -403,7 +409,7 @@ dependencies = [ "cfg-if", "futures-core", "futures-io", - "rustix 0.38.34", + "rustix 0.38.37", "signal-hook-registry", "slab", "windows-sys 0.52.0", @@ -423,7 +429,7 @@ checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" dependencies = [ "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.77", ] [[package]] @@ -542,7 +548,7 @@ dependencies = [ "cc", "cfg-if", "libc", - "miniz_oxide", + "miniz_oxide 0.7.4", "object", "rustc-demangle", ] @@ -588,9 +594,9 @@ checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "bitstream-io" -version = "2.4.2" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "415f8399438eb5e4b2f73ed3152a3448b98149dda642a957ee704e1daa5cf1d8" +checksum = "3dcde5f311c85b8ca30c2e4198d4326bc342c76541590106f5fa4a50946ea499" [[package]] name = "block" @@ -631,9 +637,9 @@ dependencies = [ [[package]] name = "built" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6a6c0b39c38fd754ac338b00a88066436389c0f029da5d37d1e01091d9b7c17" +checksum = "236e6289eda5a812bc6b53c3b024039382a2895fbbeef2d748b2931546d392c4" [[package]] name = "bumpalo" @@ -643,22 +649,22 @@ checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" [[package]] name = "bytemuck" -version = "1.16.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b236fc92302c97ed75b38da1f4917b5cdda4984745740f153a5d3059e48d725e" +checksum = "94bbb0ad554ad961ddc5da507a12a29b14e4ae5bda06b19f575a3e6079d2e2ae" dependencies = [ "bytemuck_derive", ] [[package]] name = "bytemuck_derive" -version = "1.7.0" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ee891b04274a59bd38b412188e24b849617b2e45a0fd8d057deb63e7403761b" +checksum = "0cc8b54b395f2fcfbb3d90c47b01c7f444d94d05bdeb775811dec868ac3bbc26" dependencies = [ "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.77", ] [[package]] @@ -675,9 +681,9 @@ checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495" [[package]] name = "bytes" -version = "1.6.0" +version = "1.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" +checksum = "428d9aa8fbc0670b7b8d6030a7fadd0f86151cae55e4dbbece15f3780a3dfaf3" [[package]] name = "cairo-rs" @@ -713,7 +719,7 @@ dependencies = [ "bitflags 2.6.0", "log", "polling 3.7.2", - "rustix 0.38.34", + "rustix 0.38.37", "slab", "thiserror", ] @@ -725,7 +731,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95a66a987056935f7efce4ab5668920b5d0dac4a7c99991a67395f13702ddd20" dependencies = [ "calloop", - "rustix 0.38.34", + "rustix 0.38.37", "wayland-backend", "wayland-client", ] @@ -750,13 +756,13 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.102" +version = "1.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "779e6b7d17797c0b42023d417228c02889300190e700cb074c3438d9c541d332" +checksum = "07b1695e2c7e8fc85310cde85aeaab7e3097f593c91d209d3f9df76c928100f0" dependencies = [ "jobserver", "libc", - "once_cell", + "shlex", ] [[package]] @@ -813,15 +819,15 @@ dependencies = [ [[package]] name = "cocoa" -version = "0.25.0" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6140449f97a6e97f9511815c5632d84c8aacf8ac271ad77c559218161a1373c" +checksum = "f79398230a6e2c08f5c9760610eb6924b52aa9e7950a619602baba59dcbbdbb2" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.6.0", "block", "cocoa-foundation", - "core-foundation", - "core-graphics", + "core-foundation 0.10.0", + "core-graphics 0.24.0", "foreign-types 0.5.0", "libc", "objc", @@ -829,14 +835,14 @@ dependencies = [ [[package]] name = "cocoa-foundation" -version = "0.1.2" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c6234cbb2e4c785b456c0644748b1ac416dd045799740356f8363dfe00c93f7" +checksum = "e14045fb83be07b5acf1c0884b2180461635b433455fa35d1cd6f17f1450679d" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.6.0", "block", - "core-foundation", - "core-graphics-types", + "core-foundation 0.10.0", + "core-graphics-types 0.2.0", "libc", "objc", ] @@ -924,7 +930,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f76990911f2267d837d9d0ad060aa63aaad170af40904b29461734c339030d4d" dependencies = [ "quote", - "syn 2.0.68", + "syn 2.0.77", ] [[package]] @@ -952,11 +958,21 @@ dependencies = [ "libc", ] +[[package]] +name = "core-foundation" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b55271e5c8c478ad3f38ad24ef34923091e0548492a266d19b3c0b4d82574c63" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "core-foundation-sys" -version = "0.8.6" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "core-graphics" @@ -965,8 +981,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c07782be35f9e1140080c6b96f0d44b739e2278479f64e02fdab4e32dfd8b081" dependencies = [ "bitflags 1.3.2", - "core-foundation", - "core-graphics-types", + "core-foundation 0.9.4", + "core-graphics-types 0.1.3", + "foreign-types 0.5.0", + "libc", +] + +[[package]] +name = "core-graphics" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa95a34622365fa5bbf40b20b75dba8dfa8c94c734aea8ac9a5ca38af14316f1" +dependencies = [ + "bitflags 2.6.0", + "core-foundation 0.10.0", + "core-graphics-types 0.2.0", "foreign-types 0.5.0", "libc", ] @@ -978,7 +1007,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf" dependencies = [ "bitflags 1.3.2", - "core-foundation", + "core-foundation 0.9.4", + "libc", +] + +[[package]] +name = "core-graphics-types" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d44a101f213f6c4cdc1853d4b78aef6db6bdfa3468798cc1d9912f4735013eb" +dependencies = [ + "bitflags 2.6.0", + "core-foundation 0.10.0", "libc", ] @@ -1074,7 +1114,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13b588ba4ac1a99f7f2964d24b3d896ddc6bf847ee3855dbd4366f058cfcd331" dependencies = [ "quote", - "syn 2.0.68", + "syn 2.0.77", ] [[package]] @@ -1104,7 +1144,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.68", + "syn 2.0.77", ] [[package]] @@ -1115,7 +1155,7 @@ checksum = "733cabb43482b1a1b53eee8583c2b9e8684d592215ea83efd305dd31bc2f0178" dependencies = [ "darling_core", "quote", - "syn 2.0.68", + "syn 2.0.77", ] [[package]] @@ -1131,13 +1171,13 @@ dependencies = [ [[package]] name = "derive-new" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d150dea618e920167e5973d70ae6ece4385b7164e0d799fe7c122dd0a5d912ad" +checksum = "2cdc8d50f426189eef89dac62fabfa0abb27d5cc008f25bf4156a0203325becc" dependencies = [ "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.77", ] [[package]] @@ -1150,7 +1190,7 @@ dependencies = [ "proc-macro2", "quote", "rustc_version", - "syn 2.0.68", + "syn 2.0.77", ] [[package]] @@ -1255,7 +1295,7 @@ dependencies = [ "objc2-foundation", "parking_lot", "percent-encoding", - "raw-window-handle 0.6.2", + "raw-window-handle", "static_assertions", "wasm-bindgen", "wasm-bindgen-futures", @@ -1310,7 +1350,7 @@ dependencies = [ "arboard", "egui", "log", - "raw-window-handle 0.6.2", + "raw-window-handle", "smithay-clipboard", "web-time", "webbrowser", @@ -1604,7 +1644,7 @@ checksum = "f282cfdfe92516eb26c2af8589c274c7c17681f5ecc03c18255fe741c6aa64eb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.77", ] [[package]] @@ -1625,7 +1665,7 @@ checksum = "de0d48a183585823424a4ce1aa132d174a6a81bd540895822eb4c8373a8e49e8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.77", ] [[package]] @@ -1721,7 +1761,7 @@ dependencies = [ "flume", "half", "lebe", - "miniz_oxide", + "miniz_oxide 0.7.4", "rayon-core", "smallvec", "zune-inflate", @@ -1772,15 +1812,15 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.1.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" +checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" [[package]] name = "fdeflate" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f9bfee30e4dedf0ab8b422f03af778d9612b63f502710fc500a334ebe2de645" +checksum = "d8090f921a24b04994d9929e204f50b498a33ea6ba559ffaa05e04f7ee7fb5ab" dependencies = [ "simd-adler32", ] @@ -1797,12 +1837,12 @@ dependencies = [ [[package]] name = "flate2" -version = "1.0.30" +version = "1.0.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f54427cfd1c7829e2a139fcefea601bf088ebca651d2bf53ebc600eac295dae" +checksum = "a1b589b4dc103969ad3cf85c950899926ec64300a1a46d76c03a6072957036f0" dependencies = [ "crc32fast", - "miniz_oxide", + "miniz_oxide 0.8.0", ] [[package]] @@ -1847,7 +1887,7 @@ checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" dependencies = [ "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.77", ] [[package]] @@ -1950,7 +1990,7 @@ version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "52527eb5074e35e9339c6b4e8d12600c7128b68fb25dcb9fa9dec18f7c25f3a5" dependencies = [ - "fastrand 2.1.0", + "fastrand 2.1.1", "futures-core", "futures-io", "parking", @@ -1965,7 +2005,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.77", ] [[package]] @@ -2009,9 +2049,9 @@ dependencies = [ [[package]] name = "garde" -version = "0.18.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5fa8fb3ffe035745c6194540b2064b2fe275f32367fbb4eb026024b7921e2e5" +checksum = "0a3233677ea1554a48235d81bb59d2a41654969a8e29a1316c48105fd1701693" dependencies = [ "compact_str", "garde_derive", @@ -2022,14 +2062,14 @@ dependencies = [ [[package]] name = "garde_derive" -version = "0.18.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf62650515830c41553b72bd49ec20fb120226f9277c7f2847f071cf998325b" +checksum = "8796f322e43105351a7ec35148807b32b5b6058a539656dafe4a5b456d5ca41f" dependencies = [ "proc-macro2", "quote", "regex", - "syn 2.0.68", + "syn 2.0.77", ] [[package]] @@ -2252,7 +2292,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.77", ] [[package]] @@ -2310,7 +2350,7 @@ dependencies = [ "bitflags 2.6.0", "cfg_aliases 0.2.1", "cgl", - "core-foundation", + "core-foundation 0.9.4", "dispatch", "glutin_egl_sys", "glutin_glx_sys", @@ -2320,7 +2360,7 @@ dependencies = [ "objc2-app-kit", "objc2-foundation", "once_cell", - "raw-window-handle 0.6.2", + "raw-window-handle", "wayland-sys", "windows-sys 0.52.0", "x11-dl", @@ -2334,7 +2374,7 @@ checksum = "85edca7075f8fc728f28cb8fbb111a96c3b89e930574369e3e9c27eb75d3788f" dependencies = [ "cfg_aliases 0.2.1", "glutin", - "raw-window-handle 0.6.2", + "raw-window-handle", "winit", ] @@ -2485,7 +2525,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.77", ] [[package]] @@ -2500,7 +2540,7 @@ dependencies = [ "futures-core", "futures-sink", "http", - "indexmap 2.2.6", + "indexmap 2.5.0", "slab", "tokio", "tokio-util", @@ -2647,9 +2687,9 @@ dependencies = [ [[package]] name = "http-body" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" dependencies = [ "bytes", "http", @@ -2676,9 +2716,9 @@ checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" [[package]] name = "hyper" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4fe55fb7a772d59a5ff1dfbff4fe0258d19b89fec4b233e75d35d5d2316badc" +checksum = "50dfd22e0e76d0f662d429a5f80fcaf3855009297eab6a0a9f8543834744ba05" dependencies = [ "bytes", "futures-channel", @@ -2704,7 +2744,7 @@ dependencies = [ "http", "hyper", "hyper-util", - "rustls 0.23.10", + "rustls 0.23.12", "rustls-pki-types", "tokio", "tokio-rustls", @@ -2765,12 +2805,12 @@ dependencies = [ [[package]] name = "image" -version = "0.25.1" +version = "0.25.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd54d660e773627692c524beaad361aca785a4f9f5730ce91f42aabe5bce3d11" +checksum = "99314c8a2152b8ddb211f924cdae532d8c5e4c8bb54728e12fff1b0cd5963a10" dependencies = [ "bytemuck", - "byteorder", + "byteorder-lite", "color_quant", "exr", "gif", @@ -2788,12 +2828,12 @@ dependencies = [ [[package]] name = "image-webp" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d730b085583c4d789dfd07fdcf185be59501666a90c97c40162b37e4fdad272d" +checksum = "f79afb8cbee2ef20f59ccd477a218c12a93943d075b492015ecb1bb81f8ee904" dependencies = [ "byteorder-lite", - "thiserror", + "quick-error", ] [[package]] @@ -2823,9 +2863,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.2.6" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" +checksum = "68b900aa2f7301e21c36462b170ee99994de34dff39a4a6a528e80e7376d07e5" dependencies = [ "equivalent", "hashbrown 0.14.5", @@ -2848,7 +2888,7 @@ checksum = "c34819042dc3d3971c46c2190835914dfbe0c3c13f61449b2997f4e9722dfa60" dependencies = [ "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.77", ] [[package]] @@ -2936,9 +2976,9 @@ checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" [[package]] name = "jobserver" -version = "0.1.31" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2b099aaa34a9751c5bf0878add70444e1ed2dd73f347be99003d4577277de6e" +checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" dependencies = [ "libc", ] @@ -2996,9 +3036,9 @@ checksum = "03087c2bad5e1034e8cace5926dec053fb3790248370865f5117a7d0213354c8" [[package]] name = "libc" -version = "0.2.155" +version = "0.2.159" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" +checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5" [[package]] name = "libfuzzer-sys" @@ -3018,7 +3058,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e310b3a6b5907f99202fcdb4960ff45b93735d7c7d96b760fcff8db2dc0e103d" dependencies = [ "cfg-if", - "windows-targets 0.52.5", + "windows-targets 0.52.6", ] [[package]] @@ -3123,7 +3163,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ea1f30cedd69f0a2954655f7188c6a834246d2bcf1e315e2ac40c4b24dc9519" dependencies = [ "cfg-if", - "rayon", ] [[package]] @@ -3167,7 +3206,7 @@ checksum = "7ecfd3296f8c56b7c1f6fbac3c71cefa9d78ce009850c45000015f206dc7fa21" dependencies = [ "bitflags 2.6.0", "block", - "core-graphics-types", + "core-graphics-types 0.1.3", "foreign-types 0.5.0", "log", "objc", @@ -3206,15 +3245,25 @@ dependencies = [ "simd-adler32", ] +[[package]] +name = "miniz_oxide" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" +dependencies = [ + "adler2", +] + [[package]] name = "mio" -version = "0.8.11" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" +checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" dependencies = [ + "hermit-abi 0.3.9", "libc", "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -3229,7 +3278,7 @@ dependencies = [ "cfg_aliases 0.1.1", "codespan-reporting", "hexf-parse", - "indexmap 2.2.6", + "indexmap 2.5.0", "log", "rustc-hash", "spirv", @@ -3255,20 +3304,6 @@ dependencies = [ "tempfile", ] -[[package]] -name = "ndk" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "451422b7e4718271c8b5b3aadf5adedba43dc76312454b387e98fae0fc951aa0" -dependencies = [ - "bitflags 1.3.2", - "jni-sys", - "ndk-sys 0.4.1+23.1.7779620", - "num_enum 0.5.11", - "raw-window-handle 0.5.2", - "thiserror", -] - [[package]] name = "ndk" version = "0.9.0" @@ -3279,8 +3314,8 @@ dependencies = [ "jni-sys", "log", "ndk-sys 0.6.0+11769913", - "num_enum 0.7.2", - "raw-window-handle 0.6.2", + "num_enum", + "raw-window-handle", "thiserror", ] @@ -3290,15 +3325,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" -[[package]] -name = "ndk-sys" -version = "0.4.1+23.1.7779620" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cf2aae958bd232cac5069850591667ad422d263686d75b52a065f9badeee5a3" -dependencies = [ - "jni-sys", -] - [[package]] name = "ndk-sys" version = "0.5.0+25.2.9519653" @@ -3381,7 +3407,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.77", ] [[package]] @@ -3413,44 +3439,13 @@ dependencies = [ "autocfg", ] -[[package]] -name = "num_cpus" -version = "1.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" -dependencies = [ - "hermit-abi 0.3.9", - "libc", -] - -[[package]] -name = "num_enum" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f646caf906c20226733ed5b1374287eb97e3c2a5c227ce668c1f2ce20ae57c9" -dependencies = [ - "num_enum_derive 0.5.11", -] - [[package]] name = "num_enum" version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "02339744ee7253741199f897151b38e72257d13802d4ee837285cc2990a90845" dependencies = [ - "num_enum_derive 0.7.2", -] - -[[package]] -name = "num_enum_derive" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcbff9bc912032c62bf65ef1d5aea88983b420f4f839db1e9b0c281a25c9c799" -dependencies = [ - "proc-macro-crate 1.3.1", - "proc-macro2", - "quote", - "syn 1.0.109", + "num_enum_derive", ] [[package]] @@ -3462,7 +3457,7 @@ dependencies = [ "proc-macro-crate 2.0.2", "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.77", ] [[package]] @@ -3698,9 +3693,9 @@ dependencies = [ [[package]] name = "object" -version = "0.36.1" +version = "0.36.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "081b846d1d56ddfc18fdf1a922e4f6e07a11768ea1b92dec44e42b72712ccfce" +checksum = "27b64972346851a39438c60b341ebc01bba47464ae329e55cf343eb93964efd9" dependencies = [ "memchr", ] @@ -3713,9 +3708,9 @@ checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "openssl" -version = "0.10.64" +version = "0.10.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95a0481286a310808298130d22dd1fef0fa571e05a8f44ec801801e84b216b1f" +checksum = "9529f4786b70a3e8c61e11179af17ab6188ad8d0ded78c5529441ed39d4bd9c1" dependencies = [ "bitflags 2.6.0", "cfg-if", @@ -3734,7 +3729,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.77", ] [[package]] @@ -3745,9 +3740,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.102" +version = "0.9.103" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c597637d56fbc83893a35eb0dd04b2b8e7a50c91e64e9493e398b5df4fb45fa2" +checksum = "7f9e8deee91df40a943c71b917e5874b951d32a802526c85721ce3b776c929d6" dependencies = [ "cc", "libc", @@ -3785,12 +3780,12 @@ dependencies = [ [[package]] name = "oxhttp" -version = "0.2.0" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3cc8fa85d054762930759faa582ba6b6dd0e115156229cdb8cca02b0e0451ae" +checksum = "a3621585028d2e217adcae08f9b42092790659d3a606edda6145e4e1eef044d6" dependencies = [ "httparse", - "rustls 0.23.10", + "rustls 0.23.12", "rustls-pki-types", "url", "webpki-roots", @@ -3845,9 +3840,9 @@ checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.5.2", + "redox_syscall 0.5.4", "smallvec", - "windows-targets 0.52.5", + "windows-targets 0.52.6", ] [[package]] @@ -3979,7 +3974,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.77", ] [[package]] @@ -4001,15 +3996,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae1d5c74c9876f070d3e8fd503d748c7d974c3e48da8f41350fa5222ef9b4391" dependencies = [ "atomic-waker", - "fastrand 2.1.0", + "fastrand 2.1.1", "futures-io", ] [[package]] name = "pkg-config" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" +checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" [[package]] name = "png" @@ -4021,7 +4016,7 @@ dependencies = [ "crc32fast", "fdeflate", "flate2", - "miniz_oxide", + "miniz_oxide 0.7.4", ] [[package]] @@ -4050,16 +4045,19 @@ dependencies = [ "concurrent-queue", "hermit-abi 0.4.0", "pin-project-lite", - "rustix 0.38.34", + "rustix 0.38.37", "tracing", "windows-sys 0.52.0", ] [[package]] name = "ppv-lite86" -version = "0.2.17" +version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" +dependencies = [ + "zerocopy", +] [[package]] name = "precomputed-hash" @@ -4148,7 +4146,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8021cf59c8ec9c432cfc2526ac6b8aa508ecaf29cd415f271b8406c1b851c3fd" dependencies = [ "quote", - "syn 2.0.68", + "syn 2.0.77", ] [[package]] @@ -4188,9 +4186,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -4313,25 +4311,18 @@ dependencies = [ [[package]] name = "ravif" -version = "0.11.7" +version = "0.11.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67376f469e7e7840d0040bbf4b9b3334005bb167f814621326e4c7ab8cd6e944" +checksum = "a8f0bfd976333248de2078d350bfdf182ff96e168a24d23d2436cef320dd4bdd" dependencies = [ "avif-serialize", "imgref", "loop9", "quick-error", "rav1e", - "rayon", "rgb", ] -[[package]] -name = "raw-window-handle" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2ff9a1f06a88b01621b7ae906ef0211290d1c8a168a15542486a8f61c0833b9" - [[package]] name = "raw-window-handle" version = "0.6.2" @@ -4369,9 +4360,9 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.2" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c82cf8cff14456045f55ec4241383baeff27af886adb72ffb2162f99911de0fd" +checksum = "0884ad60e090bf1345b93da0a5de8923c93884cd03f40dfcfddd3b4bee661853" dependencies = [ "bitflags 2.6.0", ] @@ -4413,9 +4404,9 @@ checksum = "19b30a45b0cd0bcca8037f3d0dc3421eaf95327a17cad11964fb8179b4fc4832" [[package]] name = "reqwest" -version = "0.12.5" +version = "0.12.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7d6d2a27d57148378eb5e111173f4276ad26340ecc5c49a4a2152167a2d6a37" +checksum = "f8f4955649ef5c38cc7f9e8aa41761d48fb9677197daea9984dc54f56aad5e63" dependencies = [ "base64", "bytes", @@ -4451,14 +4442,14 @@ dependencies = [ "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "winreg", + "windows-registry", ] [[package]] name = "rgb" -version = "0.8.40" +version = "0.8.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7439be6844e40133eda024efd85bf07f59d0dd2f59b10c00dd6cfb92cc5c741" +checksum = "57397d16646700483b67d2dd6511d79318f9d057fdbd21a4066aeac8b41d310a" dependencies = [ "bytemuck", ] @@ -4515,9 +4506,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.34" +version = "0.38.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" +checksum = "8acb788b847c24f28525660c4d7758620a7210875711f79e7f663cc152726811" dependencies = [ "bitflags 2.6.0", "errno", @@ -4542,9 +4533,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.10" +version = "0.23.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05cff451f60db80f490f3c182b77c35260baace73209e9cdbbe526bfe3a4d402" +checksum = "c58f8c84392efc0a126acce10fa59ff7b3d2ac06ab451a33f2741989b806b044" dependencies = [ "once_cell", "rustls-pki-types", @@ -4565,15 +4556,15 @@ dependencies = [ [[package]] name = "rustls-pki-types" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "976295e77ce332211c0d24d92c0e83e50f5c5f046d11082cea19f3df13a3562d" +checksum = "fc0a2ce646f8655401bb81e7927b812614bd5d91dbc968696be50603510fcaf0" [[package]] name = "rustls-webpki" -version = "0.102.4" +version = "0.102.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff448f7e92e913c4b7d4c6d8e4540a1724b319b4152b8aef6d4cf8339712b33e" +checksum = "8e6b52d4fda176fd835fdc55a835d4a89b8499cad995885a21149d5ad62f852e" dependencies = [ "ring", "rustls-pki-types", @@ -4646,7 +4637,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c627723fd09706bacdb5cf41499e95098555af3c3c29d014dc3c458ef6be11c0" dependencies = [ "bitflags 2.6.0", - "core-foundation", + "core-foundation 0.9.4", "core-foundation-sys", "libc", "security-framework-sys", @@ -4690,31 +4681,32 @@ checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" [[package]] name = "serde" -version = "1.0.203" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" +checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.203" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" +checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.77", ] [[package]] name = "serde_json" -version = "1.0.118" +version = "1.0.128" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d947f6b3163d8857ea16c4fa0dd4840d52f3041039a85decd46867eb1abef2e4" +checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" dependencies = [ "itoa 1.0.11", + "memchr", "ryu", "serde", ] @@ -4727,14 +4719,14 @@ checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.77", ] [[package]] name = "serde_spanned" -version = "0.6.6" +version = "0.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79e674e01f999af37c49f70a6ede167a8a60b2503e56c5599532a65baa5969a0" +checksum = "eb5b1b31579f3811bf615c144393417496f152e12ac8b7663bf664f4a815306d" dependencies = [ "serde", ] @@ -4783,6 +4775,12 @@ dependencies = [ "digest", ] +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + [[package]] name = "signal-hook-registry" version = "1.4.2" @@ -4856,7 +4854,7 @@ dependencies = [ "libc", "log", "memmap2", - "rustix 0.38.34", + "rustix 0.38.37", "thiserror", "wayland-backend", "wayland-client", @@ -5021,9 +5019,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.68" +version = "2.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", @@ -5035,23 +5033,26 @@ name = "sync_wrapper" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" +dependencies = [ + "futures-core", +] [[package]] name = "system-configuration" -version = "0.5.1" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" +checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" dependencies = [ - "bitflags 1.3.2", - "core-foundation", + "bitflags 2.6.0", + "core-foundation 0.9.4", "system-configuration-sys", ] [[package]] name = "system-configuration-sys" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" +checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" dependencies = [ "core-foundation-sys", "libc", @@ -5072,9 +5073,9 @@ dependencies = [ [[package]] name = "taffy" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8b61630cba2afd2c851821add2e1bb1b7851a2436e839ab73b56558b009035e" +checksum = "9cb893bff0f80ae17d3a57e030622a967b8dbc90e38284d9b4b1442e23873c94" dependencies = [ "arrayvec", "grid", @@ -5096,20 +5097,21 @@ dependencies = [ [[package]] name = "target-lexicon" -version = "0.12.14" +version = "0.12.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1fc403891a21bcfb7c37834ba66a547a8f402146eba7265b5a6d88059c9ff2f" +checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" [[package]] name = "tempfile" -version = "3.10.1" +version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" +checksum = "04cbcdd0c794ebb0d4cf35e88edd2f7d2c4c3e9a5a6dab322839b321c6a87a64" dependencies = [ "cfg-if", - "fastrand 2.1.0", - "rustix 0.38.34", - "windows-sys 0.52.0", + "fastrand 2.1.1", + "once_cell", + "rustix 0.38.37", + "windows-sys 0.59.0", ] [[package]] @@ -5140,22 +5142,22 @@ checksum = "8eaa81235c7058867fa8c0e7314f33dcce9c215f535d1913822a2b3f5e289f3c" [[package]] name = "thiserror" -version = "1.0.63" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" +checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.63" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" +checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.77", ] [[package]] @@ -5202,9 +5204,9 @@ dependencies = [ [[package]] name = "tinyvec" -version = "1.6.1" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c55115c6fbe2d2bef26eb09ad74bde02d8255476fc0c7b515ef09fbb35742d82" +checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938" dependencies = [ "tinyvec_macros", ] @@ -5217,32 +5219,31 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.38.0" +version = "1.40.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba4f4a02a7a80d6f274636f0aa95c7e383b912d41fe721a31f29e29698585a4a" +checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998" dependencies = [ "backtrace", "bytes", "libc", "mio", - "num_cpus", "parking_lot", "pin-project-lite", "signal-hook-registry", "socket2 0.5.7", "tokio-macros", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] name = "tokio-macros" -version = "2.3.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f5ae998a069d4b5aba8ee9dad856af7d520c3699e6159b185c2acd48155d39a" +checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.77", ] [[package]] @@ -5261,7 +5262,7 @@ version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" dependencies = [ - "rustls 0.23.10", + "rustls 0.23.12", "rustls-pki-types", "tokio", ] @@ -5306,7 +5307,7 @@ version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap 2.2.6", + "indexmap 2.5.0", "toml_datetime", "winnow", ] @@ -5317,7 +5318,7 @@ version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338" dependencies = [ - "indexmap 2.2.6", + "indexmap 2.5.0", "serde", "serde_spanned", "toml_datetime", @@ -5370,7 +5371,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.77", ] [[package]] @@ -5437,15 +5438,15 @@ checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unicode-normalization" -version = "0.1.23" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" +checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956" dependencies = [ "tinyvec", ] @@ -5546,7 +5547,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.77", ] [[package]] @@ -5563,9 +5564,9 @@ checksum = "852e951cb7832cb45cb1169900d19760cfa39b82bc0ea9c0e5a14ae88411c98b" [[package]] name = "version_check" -version = "0.9.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] name = "waker-fn" @@ -5626,15 +5627,15 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.77", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.42" +version = "0.4.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0" +checksum = "61e9300f63a621e96ed275155c108eb6f843b6a26d053f122ab69724559dc8ed" dependencies = [ "cfg-if", "js-sys", @@ -5660,7 +5661,7 @@ checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" dependencies = [ "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.77", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -5679,7 +5680,7 @@ checksum = "056535ced7a150d45159d3a8dc30f91a2e2d588ca0b23f70e56033622b8016f6" dependencies = [ "cc", "downcast-rs", - "rustix 0.38.34", + "rustix 0.38.37", "scoped-tls", "smallvec", "wayland-sys", @@ -5692,7 +5693,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3f45d1222915ef1fd2057220c1d9d9624b7654443ea35c3877f7a52bd0a5a2d" dependencies = [ "bitflags 2.6.0", - "rustix 0.38.34", + "rustix 0.38.37", "wayland-backend", "wayland-scanner", ] @@ -5714,7 +5715,7 @@ version = "0.31.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a206e8b2b53b1d3fcb9428fec72bc278ce539e2fa81fe2bfc1ab27703d5187b9" dependencies = [ - "rustix 0.38.34", + "rustix 0.38.37", "wayland-client", "xcursor", ] @@ -5807,7 +5808,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "425ba64c1e13b1c6e8c5d2541c8fac10022ca584f33da781db01b5756aef1f4e" dependencies = [ "block2", - "core-foundation", + "core-foundation 0.9.4", "home", "jni", "log", @@ -5873,38 +5874,38 @@ dependencies = [ [[package]] name = "webview2-com" -version = "0.31.0" +version = "0.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6516cfa64c6b3212686080eeec378e662c2af54bb2a5b2a22749673f5cb2226f" +checksum = "6f61ff3d9d0ee4efcb461b14eb3acfda2702d10dc329f339303fc3e57215ae2c" dependencies = [ "webview2-com-macros", "webview2-com-sys", - "windows 0.57.0", - "windows-core 0.57.0", - "windows-implement 0.57.0", - "windows-interface 0.57.0", + "windows 0.58.0", + "windows-core 0.58.0", + "windows-implement 0.58.0", + "windows-interface 0.58.0", ] [[package]] name = "webview2-com-macros" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac1345798ecd8122468840bcdf1b95e5dc6d2206c5e4b0eafa078d061f59c9bc" +checksum = "1d228f15bba3b9d56dde8bddbee66fa24545bd17b48d5128ccf4a8742b18e431" dependencies = [ "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.77", ] [[package]] name = "webview2-com-sys" -version = "0.31.0" +version = "0.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c76d5b77320ff155660be1df3e6588bc85c75f1a9feef938cc4dc4dd60d1d7cf" +checksum = "a3a3e2eeb58f82361c93f9777014668eb3d07e7d174ee4c819575a9208011886" dependencies = [ "thiserror", - "windows 0.57.0", - "windows-core 0.57.0", + "windows 0.58.0", + "windows-core 0.58.0", ] [[package]] @@ -5926,7 +5927,7 @@ dependencies = [ "log", "parking_lot", "profiling", - "raw-window-handle 0.6.2", + "raw-window-handle", "smallvec", "static_assertions", "wasm-bindgen", @@ -5948,13 +5949,13 @@ dependencies = [ "bitflags 2.6.0", "cfg_aliases 0.1.1", "document-features", - "indexmap 2.2.6", + "indexmap 2.5.0", "log", "naga", "once_cell", "parking_lot", "profiling", - "raw-window-handle 0.6.2", + "raw-window-handle", "rustc-hash", "smallvec", "thiserror", @@ -5973,7 +5974,7 @@ dependencies = [ "ash", "bitflags 2.6.0", "cfg_aliases 0.1.1", - "core-graphics-types", + "core-graphics-types 0.1.3", "glow 0.13.1", "glutin_wgl_sys", "gpu-alloc", @@ -5992,7 +5993,7 @@ dependencies = [ "once_cell", "parking_lot", "profiling", - "raw-window-handle 0.6.2", + "raw-window-handle", "renderdoc-sys", "rustc-hash", "smallvec", @@ -6058,7 +6059,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be" dependencies = [ "windows-core 0.52.0", - "windows-targets 0.52.5", + "windows-targets 0.52.6", ] [[package]] @@ -6070,17 +6071,17 @@ dependencies = [ "windows-core 0.54.0", "windows-implement 0.53.0", "windows-interface 0.53.0", - "windows-targets 0.52.5", + "windows-targets 0.52.6", ] [[package]] name = "windows" -version = "0.57.0" +version = "0.58.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12342cb4d8e3b046f3d80effd474a7a02447231330ef77d71daa6fbc40681143" +checksum = "dd04d41d93c4992d421894c18c8b43496aa748dd4c081bac0dc93eb0489272b6" dependencies = [ - "windows-core 0.57.0", - "windows-targets 0.52.5", + "windows-core 0.58.0", + "windows-targets 0.52.6", ] [[package]] @@ -6089,7 +6090,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ - "windows-targets 0.52.5", + "windows-targets 0.52.6", ] [[package]] @@ -6098,20 +6099,21 @@ version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "12661b9c89351d684a50a8a643ce5f608e20243b9fb84687800163429f161d65" dependencies = [ - "windows-result", - "windows-targets 0.52.5", + "windows-result 0.1.2", + "windows-targets 0.52.6", ] [[package]] name = "windows-core" -version = "0.57.0" +version = "0.58.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2ed2439a290666cd67ecce2b0ffaad89c2a56b976b736e6ece670297897832d" +checksum = "6ba6d44ec8c2591c134257ce647b7ea6b20335bf6379a27dac5f1641fcf59f99" dependencies = [ - "windows-implement 0.57.0", - "windows-interface 0.57.0", - "windows-result", - "windows-targets 0.52.5", + "windows-implement 0.58.0", + "windows-interface 0.58.0", + "windows-result 0.2.0", + "windows-strings", + "windows-targets 0.52.6", ] [[package]] @@ -6122,18 +6124,18 @@ checksum = "942ac266be9249c84ca862f0a164a39533dc2f6f33dc98ec89c8da99b82ea0bd" dependencies = [ "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.77", ] [[package]] name = "windows-implement" -version = "0.57.0" +version = "0.58.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9107ddc059d5b6fbfbffdfa7a7fe3e22a226def0b2608f72e9d552763d3e1ad7" +checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.77", ] [[package]] @@ -6144,18 +6146,29 @@ checksum = "da33557140a288fae4e1d5f8873aaf9eb6613a9cf82c3e070223ff177f598b60" dependencies = [ "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.77", ] [[package]] name = "windows-interface" -version = "0.57.0" +version = "0.58.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29bee4b38ea3cde66011baa44dba677c432a78593e202392d1e9070cf2a7fca7" +checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515" dependencies = [ "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.77", +] + +[[package]] +name = "windows-registry" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e400001bb720a623c1c69032f8e3e4cf09984deec740f007dd2b03ec864804b0" +dependencies = [ + "windows-result 0.2.0", + "windows-strings", + "windows-targets 0.52.6", ] [[package]] @@ -6164,7 +6177,26 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e383302e8ec8515204254685643de10811af0ed97ea37210dc26fb0032647f8" dependencies = [ - "windows-targets 0.52.5", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-result" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-strings" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" +dependencies = [ + "windows-result 0.2.0", + "windows-targets 0.52.6", ] [[package]] @@ -6191,7 +6223,16 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.5", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", ] [[package]] @@ -6226,18 +6267,18 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm 0.52.5", - "windows_aarch64_msvc 0.52.5", - "windows_i686_gnu 0.52.5", + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", "windows_i686_gnullvm", - "windows_i686_msvc 0.52.5", - "windows_x86_64_gnu 0.52.5", - "windows_x86_64_gnullvm 0.52.5", - "windows_x86_64_msvc 0.52.5", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", ] [[package]] @@ -6246,7 +6287,7 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6998aa457c9ba8ff2fb9f13e9d2a930dabcea28f1d0ab94d687d8b3654844515" dependencies = [ - "windows-targets 0.52.5", + "windows-targets 0.52.6", ] [[package]] @@ -6263,9 +6304,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] name = "windows_aarch64_msvc" @@ -6281,9 +6322,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] name = "windows_i686_gnu" @@ -6299,15 +6340,15 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_gnu" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" [[package]] name = "windows_i686_gnullvm" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" [[package]] name = "windows_i686_msvc" @@ -6323,9 +6364,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[package]] name = "windows_x86_64_gnu" @@ -6341,9 +6382,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnu" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" [[package]] name = "windows_x86_64_gnullvm" @@ -6359,9 +6400,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] name = "windows_x86_64_msvc" @@ -6377,9 +6418,9 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windows_x86_64_msvc" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winit" @@ -6396,14 +6437,14 @@ dependencies = [ "calloop", "cfg_aliases 0.2.1", "concurrent-queue", - "core-foundation", - "core-graphics", + "core-foundation 0.9.4", + "core-graphics 0.23.2", "cursor-icon", "dpi", "js-sys", "libc", "memmap2", - "ndk 0.9.0", + "ndk", "objc2", "objc2-app-kit", "objc2-foundation", @@ -6411,9 +6452,9 @@ dependencies = [ "orbclient", "percent-encoding", "pin-project", - "raw-window-handle 0.6.2", + "raw-window-handle", "redox_syscall 0.4.1", - "rustix 0.38.34", + "rustix 0.38.37", "sctk-adwaita", "smithay-client-toolkit", "smol_str", @@ -6442,26 +6483,16 @@ dependencies = [ "memchr", ] -[[package]] -name = "winreg" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5" -dependencies = [ - "cfg-if", - "windows-sys 0.48.0", -] - [[package]] name = "wry" -version = "0.41.0" +version = "0.45.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b00c945786b02d7805d09a969fa36d0eee4e0bd4fb3ec2a79d2bf45a1b44cd" +checksum = "ac0099a336829fbf54c26b5f620c68980ebbe37196772aeaf6118df4931b5cb0" dependencies = [ "base64", "block", "cocoa", - "core-graphics", + "core-graphics 0.24.0", "crossbeam-channel", "dpi", "dunce", @@ -6473,14 +6504,12 @@ dependencies = [ "jni", "kuchikiki", "libc", - "ndk 0.7.0", - "ndk-context", - "ndk-sys 0.4.1+23.1.7779620", + "ndk", "objc", "objc_id", "once_cell", "percent-encoding", - "raw-window-handle 0.6.2", + "raw-window-handle", "sha2", "soup3", "tao-macros", @@ -6488,8 +6517,8 @@ dependencies = [ "webkit2gtk", "webkit2gtk-sys", "webview2-com", - "windows 0.57.0", - "windows-core 0.57.0", + "windows 0.58.0", + "windows-core 0.58.0", "windows-version", "x11-dl", ] @@ -6526,7 +6555,7 @@ dependencies = [ "libc", "libloading", "once_cell", - "rustix 0.38.34", + "rustix 0.38.37", "x11rb-protocol", ] @@ -6645,22 +6674,23 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.7.34" +version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae87e3fcd617500e5d106f0380cf7b77f3c6092aae37191433159dda23cfb087" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" dependencies = [ + "byteorder", "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.34" +version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.77", ] [[package]] @@ -6686,9 +6716,9 @@ dependencies = [ [[package]] name = "zune-jpeg" -version = "0.4.11" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec866b44a2a1fd6133d363f073ca1b179f438f99e7e5bfb1e33f7181facfe448" +checksum = "16099418600b4d8f028622f73ff6e3deaabdff330fb9a2a131dea781ee8b0768" dependencies = [ "zune-core", ] diff --git a/Cargo.toml b/Cargo.toml index a8734c9..c9b1ad1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -92,18 +92,15 @@ unsafe_code = "deny" [workspace.lints.clippy] pedantic = { level = "deny", priority = 1 } enum_glob_use = { level = "deny", priority = 2 } -module_name_repetitions = { level = "allow", priority = 3 } -cast_precision_loss = { level = "allow", priority = 4 } -cast_possible_truncation = { level = "allow", priority = 5 } -cast_sign_loss = { level = "allow", priority = 6 } -out_of_bounds_indexing = { level = "allow", priority = 7 } -perf = { level = "warn", priority = 8 } -style = { level = "warn", priority = 9 } +perf = { level = "warn", priority = 3 } +style = { level = "warn", priority = 4 } # TODO: Uncomment/Deny the following lines when the clippy lints are fixed -#unwrap_used = { level = "deny", priority = 10 } -#expect_used = { level = "deny", priority = 11 } -# needless_doctest_main = { level = "allow", priority = 12 } -# implicit_hasher = { level = "allow", priority = 13 } +# unwrap_used = { level = "deny", priority = 100 } +#expect_used = { level = "deny", priority = 101 } +module_name_repetitions = { level = "allow", priority = 10 } +cast_precision_loss = { level = "allow", priority = 11 } +cast_possible_truncation = { level = "allow", priority = 12 } +cast_sign_loss = { level = "allow", priority = 13 } float_cmp = { level = "allow", priority = 14 } struct_excessive_bools = { level = "allow", priority = 15 } must_use_candidate = { level = "allow", priority = 16 } @@ -111,6 +108,7 @@ return_self_not_must_use = { level = "allow", priority = 17 } missing_panics_doc = { level = "allow", priority = 18 } missing_errors_doc = { level = "allow", priority = 19 } missing_fields_in_debug = { level = "allow", priority = 20 } +doc_markdown = { level = "allow", priority = 21 } [patch.crates-io] #wry = { path = "../../RustroverProjects/github/wry" } diff --git a/crates/egui_form/Cargo.toml b/crates/egui_form/Cargo.toml index f3dbb61..e3bceb5 100644 --- a/crates/egui_form/Cargo.toml +++ b/crates/egui_form/Cargo.toml @@ -32,13 +32,13 @@ required-features = ["validator_garde"] [dependencies] egui.workspace = true -garde = { version = "0.18.0", optional = true } +garde = { version = "0.20.0", optional = true } validator = { version = "0.18.1", optional = true } [dev-dependencies] eframe = { workspace = true, features = ["default"] } -garde = { version = "0.18.0", features = ["email", "derive"] } +garde = { version = "0.20.0", features = ["email", "derive"] } validator = { version = "0.18.1", features = ["derive"] } [lints] diff --git a/crates/egui_form/examples/egui_form_minimal.rs b/crates/egui_form/examples/egui_form_minimal.rs index bb07e53..5d57b9e 100644 --- a/crates/egui_form/examples/egui_form_minimal.rs +++ b/crates/egui_form/examples/egui_form_minimal.rs @@ -11,14 +11,14 @@ struct Fields { } fn form_ui(ui: &mut Ui, fields: &mut Fields) { - let mut form = Form::new().add_report(GardeReport::new(fields.validate(&()))); + let mut form = Form::new().add_report(GardeReport::new(fields.validate())); FormField::new(&mut form, field_path!("user_name")) .label("User Name") .ui(ui, TextEdit::singleline(&mut fields.user_name)); if let Some(Ok(())) = form.handle_submit(&ui.button("Submit"), ui) { - println!("Submitted: {:?}", fields); + println!("Submitted: {fields:?}"); } } diff --git a/crates/egui_form/examples/garde.rs b/crates/egui_form/examples/garde.rs index f158f57..4223ff6 100644 --- a/crates/egui_form/examples/garde.rs +++ b/crates/egui_form/examples/garde.rs @@ -24,7 +24,7 @@ struct Nested { } fn form_ui(ui: &mut egui::Ui, test: &mut Test) { - let mut form = Form::new().add_report(egui_form::garde::GardeReport::new(test.validate(&()))); + let mut form = Form::new().add_report(egui_form::garde::GardeReport::new(test.validate())); FormField::new(&mut form, "user_name") .label("User Name") @@ -43,7 +43,7 @@ fn form_ui(ui: &mut egui::Ui, test: &mut Test) { ); if let Some(Ok(())) = form.handle_submit(&ui.button("Submit"), ui) { - println!("Form submitted: {:?}", test); + println!("Form submitted: {test:?}"); } } @@ -81,7 +81,7 @@ mod tests { vec: vec![Nested { test: 0 }], }; - let report = GardeReport::new(test.validate(&())); + let report = GardeReport::new(test.validate()); assert!(report .get_field_error("user_name".into_field_path()) diff --git a/crates/egui_form/src/garde.rs b/crates/egui_form/src/garde.rs index 8db4eae..b693810 100644 --- a/crates/egui_form/src/garde.rs +++ b/crates/egui_form/src/garde.rs @@ -7,7 +7,7 @@ use crate::validation_report::IntoFieldPath; pub use garde; use garde::Path; -/// Create a [garde::Path] to be submitted to [crate::FormField::new] +/// Create a [`garde::Path`] to be submitted to [`crate::FormField::new`] /// Example: /// ```rust /// use egui_form::garde::field_path; @@ -29,12 +29,12 @@ macro_rules! _garde_field_path { }; } -/// A wrapper around a [garde::Report] that implements [EguiValidationReport]. +/// A wrapper around a [`garde::Report`] that implements [`EguiValidationReport`]. pub struct GardeReport(BTreeMap); impl GardeReport { - /// Create a new [GardeReport] from a [garde::Report]. - /// You can call this function with the result of a call to [garde::Validate::validate]. + /// Create a new [`GardeReport`] from a [`garde::Report`]. + /// You can call this function with the result of a call to [`garde::Validate::validate`]. /// /// # Example /// ``` diff --git a/crates/egui_form/src/lib.rs b/crates/egui_form/src/lib.rs index 6e63a36..e4a7514 100644 --- a/crates/egui_form/src/lib.rs +++ b/crates/egui_form/src/lib.rs @@ -4,9 +4,9 @@ mod form; -/// To use [garde] with egui_form, you need to create a [garde::GardeReport] and pass it to the [Form] instance. +/// To use [garde] with `egui_form`, you need to create a [`garde::GardeReport`] and pass it to the [Form] instance. /// -/// Then, when you create a [FormField], you pass the field's name as a &str. +/// Then, when you create a [`FormField`], you pass the field's name as a &str. /// For nested fields and arrays, the syntax for the field name looks like this: /// `nested.array[0].field` /// diff --git a/crates/egui_inbox/Cargo.toml b/crates/egui_inbox/Cargo.toml index 1e191b4..ba016b5 100644 --- a/crates/egui_inbox/Cargo.toml +++ b/crates/egui_inbox/Cargo.toml @@ -52,7 +52,7 @@ tokio = { version = "1", features = ["full"] } ehttp = { version = "0.5.0", features = ["json"] } serde_json = "1" rand = "0.8" -derive-new = "0.6" +derive-new = "0.7" [lints] workspace = true diff --git a/crates/egui_inbox/examples/broadcast.rs b/crates/egui_inbox/examples/broadcast.rs index 161af38..9f226f9 100644 --- a/crates/egui_inbox/examples/broadcast.rs +++ b/crates/egui_inbox/examples/broadcast.rs @@ -23,7 +23,7 @@ impl AuthUi { fn ui(&mut self, ui: &mut egui::Ui) { let mut logout = false; if let Some(user) = &self.logged_in_as { - ui.label(format!("Logged in as: {}", user)); + ui.label(format!("Logged in as: {user}")); if ui.button("Log out").clicked() { self.app_state .auth_broadcast diff --git a/crates/egui_inbox/examples/inbox_spawn.rs b/crates/egui_inbox/examples/inbox_spawn.rs index 6600694..c8b6420 100644 --- a/crates/egui_inbox/examples/inbox_spawn.rs +++ b/crates/egui_inbox/examples/inbox_spawn.rs @@ -1,3 +1,4 @@ +use eframe::NativeOptions; use egui::{CentralPanel, Window}; use tokio::time::sleep; @@ -21,39 +22,43 @@ async fn main() -> eframe::Result<()> { let mut id_idx = 0; let mut windows: Vec = Vec::new(); - eframe::run_simple_native("Inbox Example", Default::default(), move |ctx, _frame| { - CentralPanel::default().show(ctx, |ui| { - if ui.button("New Window").clicked() { - id_idx += 1; - let mut inbox = UiInbox::new(); - inbox.spawn(|tx| async move { - let _guard = DropGuard(id_idx); - let mut count = 0; - loop { - sleep(std::time::Duration::from_secs(1)).await; - count += 1; - // Since our task will be cancelled when the inbox is dropped - // we can just ignore the send error - tx.send(count).ok(); - } - }); - windows.push(MyWindow { - id: id_idx, - count: 0, - inbox, - }); - } - - windows.retain_mut(|MyWindow { id, count, inbox }| { - let mut open = true; - Window::new(format!("Window {}", id)) - .open(&mut open) - .show(ui.ctx(), |ui| { - inbox.replace(ui, count); - ui.label(format!("Count: {}", count)); + eframe::run_simple_native( + "Inbox Example", + NativeOptions::default(), + move |ctx, _frame| { + CentralPanel::default().show(ctx, |ui| { + if ui.button("New Window").clicked() { + id_idx += 1; + let mut inbox = UiInbox::new(); + inbox.spawn(|tx| async move { + let _guard = DropGuard(id_idx); + let mut count = 0; + loop { + sleep(std::time::Duration::from_secs(1)).await; + count += 1; + // Since our task will be cancelled when the inbox is dropped + // we can just ignore the send error + tx.send(count).ok(); + } }); - open + windows.push(MyWindow { + id: id_idx, + count: 0, + inbox, + }); + } + + windows.retain_mut(|MyWindow { id, count, inbox }| { + let mut open = true; + Window::new(format!("Window {id}")) + .open(&mut open) + .show(ui.ctx(), |ui| { + inbox.replace(ui, count); + ui.label(format!("Count: {count}")); + }); + open + }); }); - }); - }) + }, + ) } diff --git a/crates/egui_inbox/examples/router_login.rs b/crates/egui_inbox/examples/router_login.rs index 0a0fef0..a505ce3 100644 --- a/crates/egui_inbox/examples/router_login.rs +++ b/crates/egui_inbox/examples/router_login.rs @@ -2,14 +2,14 @@ /// utilizing the `TypeInbox` as a message passing system between independent components. /// /// The `TypeInbox` can be utilized as a application wide message bus, where components can send messages -/// to each other, without the AppState even having to know about any of the message types. +/// to each other, without the `AppState` even having to know about any of the message types. /// /// The individual components could be in seperate modules or even seperate crates, with the messages and /// events being defined in a shared crate. use std::sync::Arc; use derive_new::new; -use eframe::egui; +use eframe::{egui, NativeOptions}; use egui::{vec2, Area, CentralPanel, Context, Id, Ui, Window}; use parking_lot::Mutex; @@ -54,7 +54,7 @@ struct AppState { mod home { use derive_new::new; - use crate::*; + use crate::{AppState, AuthMessage, RouterMessage, Ui}; #[derive(new)] pub struct HomeUi { @@ -83,7 +83,9 @@ mod home { mod dashboard { use derive_new::new; - use crate::*; + use crate::{ + AppState, AuthEvent, AuthMessage, BroadcastReceiver, Context, RouterMessage, Ui, UiInbox, + }; #[derive(new)] pub struct DashboardUi { @@ -123,10 +125,10 @@ mod dashboard { let user = self.app_state.auth.lock(); if let Some(user) = user.as_ref() { - ui.label(format!("Welcome, {}!", user)); + ui.label(format!("Welcome, {user}!")); if let Some(lucky_number) = self.lucky_number { - ui.label(format!("Your lucky number is: {}", lucky_number)); + ui.label(format!("Your lucky number is: {lucky_number}")); } else { ui.label("Our magicians are still calculating your lucky number..."); ui.spinner(); @@ -147,7 +149,7 @@ mod dashboard { mod auth { use derive_new::new; - use crate::*; + use crate::{egui, AppState, AuthEvent, AuthMessage, Context, RouterMessage, Window}; #[derive(new)] pub struct AuthDialog { @@ -249,11 +251,11 @@ fn main() -> eframe::Result<()> { eframe::run_simple_native( "DnD Simple Example", - Default::default(), + NativeOptions::default(), move |ctx, _frame| { let (state, auth, router, auth_rx) = state.get_or_insert_with(|| { let state = AppState { - inbox: TypeInbox::new(ctx.clone()), + inbox: TypeInbox::new(ctx), auth: Arc::new(Mutex::new(None)), broadcast: TypeBroadcast::new(), }; diff --git a/crates/egui_inbox/src/broadcast.rs b/crates/egui_inbox/src/broadcast.rs index 9f810eb..92b64a1 100644 --- a/crates/egui_inbox/src/broadcast.rs +++ b/crates/egui_inbox/src/broadcast.rs @@ -6,15 +6,15 @@ use parking_lot::Mutex; use crate::{UiInbox, UiInboxSender}; /// A broadcast channel that can be used to send messages to multiple receivers. -/// Basically a mpmc version of [crate::UiInbox]. +/// Basically a mpmc version of [`crate::UiInbox`]. /// -/// Internally, this is basically a Vec>, so it's not optimized for crazy performance. +/// Internally, this is basically a Vec<`UiInboxSender`>, so it's not optimized for crazy performance. /// The goal is to provide a really convenient way to send broadcasts in egui (or other immediate mode GUIs). /// /// NOTE: This is an unbounded channel, and each receivers queue is only emptied when it is read. /// So if you don't read from a receiver, it might cause a memory leak. If you send a lot /// of messages and only show a receiver's ui conditionally, it might make sense to read -/// the receiver in a separate update function. This is demonstrated in the router_login example. +/// the receiver in a separate update function. This is demonstrated in the `router_login` example. #[derive(Debug, Clone)] pub struct Broadcast { senders: Arc>>>, @@ -34,7 +34,7 @@ impl Broadcast { Self::default() } - /// Subscribe to the broadcast channel, receiving a [BroadcastReceiver] of type [T]. + /// Subscribe to the broadcast channel, receiving a [`BroadcastReceiver`] of type [T]. pub fn subscribe(&self) -> BroadcastReceiver { let (tx, rx) = UiInbox::channel(); self.senders.lock().push(tx); @@ -42,6 +42,7 @@ impl Broadcast { } /// Send a message of type [T] to all subscribers. + #[allow(clippy::needless_pass_by_value)] pub fn send(&self, message: T) where T: Clone + MaybeSend + 'static, @@ -51,6 +52,6 @@ impl Broadcast { } } -/// A receiver for a [Broadcast]. This is currently just a re-export of [crate::UiInbox], but this might +/// A receiver for a [Broadcast]. This is currently just a re-export of [`crate::UiInbox`], but this might /// change in the future, so make sure you always use this type when you subscribe to a broadcast. pub type BroadcastReceiver = UiInbox; diff --git a/crates/egui_inbox/src/lib.rs b/crates/egui_inbox/src/lib.rs index 142ec15..2e03cd5 100644 --- a/crates/egui_inbox/src/lib.rs +++ b/crates/egui_inbox/src/lib.rs @@ -6,7 +6,7 @@ #[cfg(feature = "broadcast")] pub mod broadcast; -/// Broadcast based on [type_map], useful for sending events between different parts of the application. +/// Broadcast based on [`type_map`], useful for sending events between different parts of the application. #[cfg(feature = "type_broadcast")] pub mod type_broadcast; @@ -359,7 +359,7 @@ mod async_impl { /// Spawns a future that will automatically be cancelled when the inbox is dropped. /// Make sure your future is safe to cancel (It may stop at any await point). /// - /// If you want to spawn a future that should definitely run to completion, use [UiInbox::spawn_detached] instead. + /// If you want to spawn a future that should definitely run to completion, use [`UiInbox::spawn_detached`] instead. pub fn spawn(&mut self, f: impl FnOnce(UiInboxSender) -> F) where F: std::future::Future + MaybeSend + 'static, @@ -374,7 +374,7 @@ mod async_impl { let mut future = pin!(future); select! { - _ = future => {}, + () = future => {}, _ = rx => {}, } }); diff --git a/crates/egui_inbox/src/type_broadcast.rs b/crates/egui_inbox/src/type_broadcast.rs index 49a28d3..a0e312d 100644 --- a/crates/egui_inbox/src/type_broadcast.rs +++ b/crates/egui_inbox/src/type_broadcast.rs @@ -9,23 +9,23 @@ use type_map::TypeMap; use crate::broadcast::{Broadcast, BroadcastReceiver}; -/// A broadcast based on [type_map], which can be used to handle broadcasts between different parts of the application. -/// Call [TypeBroadcast::subscribe] to subscribe to a broadcast, receiving a [BroadcastReceiver]. -/// Call [TypeBroadcast::send] to send a message to all subscribers. +/// A broadcast based on [`type_map`], which can be used to handle broadcasts between different parts of the application. +/// Call [`TypeBroadcast::subscribe`] to subscribe to a broadcast, receiving a [`BroadcastReceiver`]. +/// Call [`TypeBroadcast::send`] to send a message to all subscribers. /// -/// Use [crate::type_inbox::TypeInbox] instead, if you want to send messages to specific components (mpsc like channel). +/// Use [`crate::type_inbox::TypeInbox`] instead, if you want to send messages to specific components (mpsc like channel). #[derive(Debug, Clone, Default)] pub struct TypeBroadcast { broadcasts: Arc>, } impl TypeBroadcast { - /// Create a new [TypeBroadcast]. + /// Create a new [`TypeBroadcast`]. pub fn new() -> Self { Self::default() } - /// Subscribe to a broadcast, receiving a [BroadcastReceiver] of type [T]. + /// Subscribe to a broadcast, receiving a [`BroadcastReceiver`] of type [T]. pub fn subscribe(&self) -> BroadcastReceiver { self.broadcasts .lock() @@ -35,7 +35,7 @@ impl TypeBroadcast { } /// Send a message of type [T] to all subscribers. - /// If there are any subscribers with a [crate::RequestRepaintContext] attached, a repaint will be requested. + /// If there are any subscribers with a [`crate::RequestRepaintContext`] attached, a repaint will be requested. pub fn send(&self, message: T) { let mut broadcasts = self.broadcasts.lock(); let entry = broadcasts.entry().or_insert_with(|| Broadcast::new()); diff --git a/crates/egui_infinite_scroll/examples/infinite_scroll_async.rs b/crates/egui_infinite_scroll/examples/infinite_scroll_async.rs index 1605fae..0ad16bc 100644 --- a/crates/egui_infinite_scroll/examples/infinite_scroll_async.rs +++ b/crates/egui_infinite_scroll/examples/infinite_scroll_async.rs @@ -1,4 +1,4 @@ -use eframe::egui; +use eframe::{egui, NativeOptions}; use egui::{CentralPanel, ScrollArea}; use egui_infinite_scroll::InfiniteScroll; use std::time::Duration; @@ -14,7 +14,7 @@ pub async fn main() -> eframe::Result<()> { eframe::run_simple_native( "Infinite Scroll Simple Example", - Default::default(), + NativeOptions::default(), move |ctx, _frame| { CentralPanel::default().show(ctx, |ui| { ScrollArea::vertical().show(ui, |ui| { @@ -24,7 +24,7 @@ pub async fn main() -> eframe::Result<()> { }; infinite_scroll.ui(ui, 10, |ui, _index, item| { - ui.label(format!("Item {}", item)); + ui.label(format!("Item {item}")); }); if infinite_scroll.bottom_loading_state().loading() { diff --git a/crates/egui_infinite_scroll/examples/infinite_scroll_table.rs b/crates/egui_infinite_scroll/examples/infinite_scroll_table.rs index 1e244cd..fefb5f6 100644 --- a/crates/egui_infinite_scroll/examples/infinite_scroll_table.rs +++ b/crates/egui_infinite_scroll/examples/infinite_scroll_table.rs @@ -1,4 +1,4 @@ -use eframe::egui; +use eframe::{egui, NativeOptions}; use egui::CentralPanel; use egui_extras::Column; @@ -13,7 +13,7 @@ pub fn main() -> eframe::Result<()> { eframe::run_simple_native( "Infinite Scroll Simple Example", - Default::default(), + NativeOptions::default(), move |ctx, _frame| { CentralPanel::default().show(ctx, |ui| { if ui.button("Reset").clicked() { @@ -32,7 +32,7 @@ pub fn main() -> eframe::Result<()> { }); ui.col(|ui| { - ui.label(format!("{}", item)); + ui.label(format!("{item}")); }); }); }); diff --git a/crates/egui_infinite_scroll/src/lib.rs b/crates/egui_infinite_scroll/src/lib.rs index 5562fb5..0cf5ddf 100644 --- a/crates/egui_infinite_scroll/src/lib.rs +++ b/crates/egui_infinite_scroll/src/lib.rs @@ -403,7 +403,7 @@ impl }); } - /// Layout for to use with [egui_extras::TableBody]. + /// Layout for to use with [`egui_extras::TableBody`]. #[cfg(feature = "egui_extras")] pub fn ui_table( &mut self, diff --git a/crates/egui_router/examples/async_router.rs b/crates/egui_router/examples/async_router.rs index a7ed1be..61fc619 100644 --- a/crates/egui_router/examples/async_router.rs +++ b/crates/egui_router/examples/async_router.rs @@ -24,7 +24,7 @@ async fn main() -> eframe::Result<()> { let router = router.get_or_insert_with(|| { EguiRouter::builder() .error_ui(|ui, state: &AppState, error| { - ui.label(format!("Error: {}", error)); + ui.label(format!("Error: {error}")); if ui.button("back").clicked() { state.clone().send(RouterMessage::Back).ok(); } @@ -96,7 +96,7 @@ async fn post(request: OwnedRequest) -> HandlerResult eframe::Result<()> { let init = |ctx: &Context| { let mut app_state = AppState { message: "Hello, World!".to_string(), - inbox: TypeInbox::new(ctx.clone()), + inbox: TypeInbox::new(ctx), }; let mut router = EguiRouter::builder() .transition(TransitionConfig::fade_up().with_easing(egui_animation::easing::quad_out)) @@ -46,7 +46,7 @@ async fn main() -> eframe::Result<()> { let mut router = router.get_or_insert_with(|| init(ctx)); let mut window_router = window_router.get_or_insert_with(|| init(ctx)); - for state in [&mut router, &mut window_router].iter_mut() { + for state in &mut [&mut router, &mut window_router] { state .1 .inbox @@ -148,12 +148,12 @@ fn post(mut request: Request) -> impl Route { background(ui, ui.style().visuals.extreme_bg_color, |ui| { ScrollArea::vertical().show(ui, |ui| { if let Some(id) = &id { - ui.label(format!("Post: {}", id)); + ui.label(format!("Post: {id}")); ui.label(format!("Id: {:?}", ui.next_auto_id())); if let Some(search) = &search { - ui.label(format!("Search: {}", search)); + ui.label(format!("Search: {search}")); } if ui.button("back").clicked() { diff --git a/crates/egui_router/src/lib.rs b/crates/egui_router/src/lib.rs index d0c1094..551222d 100644 --- a/crates/egui_router/src/lib.rs +++ b/crates/egui_router/src/lib.rs @@ -151,7 +151,7 @@ pub struct Request<'a, State = ()> { } #[cfg(feature = "async")] -/// Owned request, passed to [handler::AsyncMakeHandler] +/// Owned request, passed to [`handler::AsyncMakeHandler`] pub struct OwnedRequest { /// The parsed path params pub params: BTreeMap, diff --git a/crates/egui_router/src/router_builder.rs b/crates/egui_router/src/router_builder.rs index 71e3609..7124d24 100644 --- a/crates/egui_router/src/router_builder.rs +++ b/crates/egui_router/src/router_builder.rs @@ -151,7 +151,7 @@ impl RouterBuilder { } /// Add an async route. Check the [matchit] documentation for information about the route syntax. - /// The handler will be called with [crate::OwnedRequest] and should return a [Route]. + /// The handler will be called with [`crate::OwnedRequest`] and should return a [Route]. /// /// # Example /// ```rust diff --git a/crates/egui_suspense/Cargo.toml b/crates/egui_suspense/Cargo.toml index 5ab82e0..b415a48 100644 --- a/crates/egui_suspense/Cargo.toml +++ b/crates/egui_suspense/Cargo.toml @@ -26,7 +26,7 @@ required-features = ["async", "tokio"] [dev-dependencies] eframe = { workspace = true, default-features = true } rand = "0.8.5" -reqwest = { version = "0.12.5", features = ["json"] } +reqwest = { version = "0.12.7", features = ["json"] } tokio = { version = "1", features = ["full"] } futures = "0.3" diff --git a/crates/egui_taffy/Cargo.toml b/crates/egui_taffy/Cargo.toml index 1a219ba..592c222 100644 --- a/crates/egui_taffy/Cargo.toml +++ b/crates/egui_taffy/Cargo.toml @@ -10,7 +10,7 @@ release = false [dependencies] egui.workspace = true -taffy = "0.5.1" +taffy = "0.5.2" [dev-dependencies] eframe = { workspace = true, default-features = true } diff --git a/crates/egui_thumbhash/Cargo.toml b/crates/egui_thumbhash/Cargo.toml index c716e85..4259b37 100644 --- a/crates/egui_thumbhash/Cargo.toml +++ b/crates/egui_thumbhash/Cargo.toml @@ -22,7 +22,7 @@ egui_extras = { workspace = true, default-features = true, features = [ "http", ] } -oxhttp = { version = "0.2.0", default-features = false, features = [ +oxhttp = { version = "0.2.2", default-features = false, features = [ "client", "rustls", "webpki-roots", @@ -30,7 +30,7 @@ oxhttp = { version = "0.2.0", default-features = false, features = [ ] } serde = { version = "1", features = ["derive"] } serde_json = "1" -image = "0.25.1" +image = "0.25.2" [lints] workspace = true diff --git a/crates/egui_webview/Cargo.toml b/crates/egui_webview/Cargo.toml index 1ffe921..eebf826 100644 --- a/crates/egui_webview/Cargo.toml +++ b/crates/egui_webview/Cargo.toml @@ -8,16 +8,16 @@ publish = false release = false [dependencies] -wry = "0.41.0" +wry = "0.45.0" egui.workspace = true egui_inbox = { workspace = true } -image = "0.25.1" +image = "0.25.2" base64 = "0.22.1" egui_extras = { workspace = true, features = ["image"] } -serde = { version = "1.0.195", features = ["derive"] } +serde = { version = "1.0.210", features = ["derive"] } serde_json = "1" -log = "0.4.20" +log = "0.4.22" rgb = "0.8" [dev-dependencies] diff --git a/fancy-example/Cargo.toml b/fancy-example/Cargo.toml index a8e4ebd..88edb8b 100644 --- a/fancy-example/Cargo.toml +++ b/fancy-example/Cargo.toml @@ -26,11 +26,11 @@ egui_extras = { workspace = true, features = ["http", "image"] } ehttp = { version = "0.5.0" } thumbhash = "0.1.0" -image = { version = "0.25.1", features = ["jpeg", "png", "webp"] } +image = { version = "0.25.2", features = ["jpeg", "png", "webp"] } color-hex = "0.2.0" -wasm-bindgen = "0.2.83" -wasm-bindgen-futures = "0.4.33" +wasm-bindgen = "0.2.93" +wasm-bindgen-futures = "0.4.43" serde = { version = "1", features = ["derive"] } serde_json = "1" @@ -46,7 +46,7 @@ tokio = { version = "1", features = ["time", "rt", "macros"] } ureq = "2" [target.'cfg(target_arch = "wasm32")'.dependencies] -wasm-bindgen-futures = "0.4.39" +wasm-bindgen-futures = "0.4.43" gloo-timers = { version = "0.3.0", features = ["futures"] } [lints] From c313479a71b0f4dc2827879479a0dd0d729a41eb Mon Sep 17 00:00:00 2001 From: Nicolas Date: Fri, 27 Sep 2024 00:03:40 +0200 Subject: [PATCH 13/16] also ran `cargo update` --- Cargo.lock | 464 ++++++++++++++++++++--------------------------------- 1 file changed, 176 insertions(+), 288 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e1153ae..ed3abdf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "ab_glyph" -version = "0.2.27" +version = "0.2.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c3a1cbc201cc13ed06cf875efb781f2249b3677f5c74571b67d817877f9d697" +checksum = "79faae4620f45232f599d9bc7b290f88247a0834162c4495ab2f02d60004adfb" dependencies = [ "ab_glyph_rasterizer", "owned_ttf_parser", @@ -20,15 +20,15 @@ checksum = "c71b1793ee61086797f5c80b6efa2b8ffa6d5dd703f118545808a7f2e27f7046" [[package]] name = "accesskit" -version = "0.16.0" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4700bdc115b306d6c43381c344dc307f03b7f0460c304e4892c309930322bd7" +checksum = "ef7442f1f520649b8e11ee3af6caeec24123fed4b63bc36a85b67308d8514fdf" [[package]] name = "accesskit_atspi_common" -version = "0.9.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1de72dc7093910a1284cef784b6b143bab0a34d67f6178e4fc3aaaf29a09f8b" +checksum = "ab9d2b364833ae6e2eae9359a374108b1c5488877a9f43d26f0cb700560af9ae" dependencies = [ "accesskit", "accesskit_consumer", @@ -40,9 +40,9 @@ dependencies = [ [[package]] name = "accesskit_consumer" -version = "0.24.0" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe3a07a32ab5837ad83db3230ac490c8504c2cd5b90ac8c00db6535f6ed65d0b" +checksum = "7072a4f17b8e7440a88ce08eb657d1ec84be061b1a94be78f9699aa18e583885" dependencies = [ "accesskit", "immutable-chunkmap", @@ -50,9 +50,9 @@ dependencies = [ [[package]] name = "accesskit_macos" -version = "0.17.0" +version = "0.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a189d159c153ae0fce5f9eefdcfec4a27885f453ce5ef0ccf078f72a73c39d34" +checksum = "716698a26b5113812348a9f99ec250cb7b4154c89a83bc55a8b7d8678a1ecf02" dependencies = [ "accesskit", "accesskit_consumer", @@ -64,9 +64,9 @@ dependencies = [ [[package]] name = "accesskit_unix" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b76c448cfd96d16131a9ad3ab786d06951eb341cdac1db908978ab010245a19d" +checksum = "fd552c7bae0cd2ba1131fb0cedad32f8915743e0ed086f989fd706431641f56e" dependencies = [ "accesskit", "accesskit_atspi_common", @@ -82,22 +82,23 @@ dependencies = [ [[package]] name = "accesskit_windows" -version = "0.22.0" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "682d8c4fb425606f97408e7577793f32e96310b646fa77662eb4216293eddc7f" +checksum = "4d134e9eb16c98b35d1ff7056a027d7482968bcab0d8b625e7e72895b748d705" dependencies = [ "accesskit", "accesskit_consumer", "paste", "static_assertions", - "windows 0.54.0", + "windows 0.58.0", + "windows-core 0.58.0", ] [[package]] name = "accesskit_winit" -version = "0.22.0" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9afbd6d598b7c035639ad2b664aa0edc94c93dc1fc3ebb4b40d8a95fcd43ffac" +checksum = "156c5066e7b3ac9a82fb80fc18dcee42f79967c47e0ff431bae23e7ee8412a83" dependencies = [ "accesskit", "accesskit_macos", @@ -109,9 +110,9 @@ dependencies = [ [[package]] name = "addr2line" -version = "0.22.0" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" +checksum = "f5fb1d8e4442bd405fdfd1dacb42792696b0cf9cb15882e5d097b742a676d375" dependencies = [ "gimli", ] @@ -212,9 +213,9 @@ checksum = "7d5a26814d8dcb93b0e5a0ff3c6d80a8843bafb21b39e8e18a6f05471870e110" [[package]] name = "arboard" -version = "3.4.0" +version = "3.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb4009533e8ff8f1450a5bcbc30f4242a1d34442221f72314bea1f5dc9c7f89" +checksum = "df099ccb16cd014ff054ac1bf392c67feeef57164b05c42f037cd40f5d4357f4" dependencies = [ "clipboard-win", "log", @@ -238,9 +239,9 @@ dependencies = [ [[package]] name = "arrayref" -version = "0.3.7" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" +checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb" [[package]] name = "arrayvec" @@ -287,9 +288,9 @@ dependencies = [ [[package]] name = "async-executor" -version = "1.12.0" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8828ec6e544c02b0d6691d21ed9f9218d0384a82542855073c2a3f58304aaf0" +checksum = "30ca9a001c1e8ba5149f91a74362376cc6bc5b919d92d988668657bd570bdcec" dependencies = [ "async-task", "concurrent-queue", @@ -332,9 +333,9 @@ dependencies = [ [[package]] name = "async-io" -version = "2.3.3" +version = "2.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d6baa8f0178795da0e71bc42c9e5d13261aac7ee549853162e66a241ba17964" +checksum = "444b0228950ee6501b3568d3c93bf1176a1fdbc3b758dcd9475046d30f4dc7e8" dependencies = [ "async-lock 3.4.0", "cfg-if", @@ -342,11 +343,11 @@ dependencies = [ "futures-io", "futures-lite 2.3.0", "parking", - "polling 3.7.2", + "polling 3.7.3", "rustix 0.38.37", "slab", "tracing", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -399,11 +400,11 @@ dependencies = [ [[package]] name = "async-signal" -version = "0.2.8" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "794f185324c2f00e771cd9f1ae8b5ac68be2ca7abb129a87afd6e86d228bc54d" +checksum = "637e00349800c0bdf8bfc21ebbc0b6524abea702b0da4168ac00d070d0c0b9f3" dependencies = [ - "async-io 2.3.3", + "async-io 2.3.4", "async-lock 3.4.0", "atomic-waker", "cfg-if", @@ -412,7 +413,7 @@ dependencies = [ "rustix 0.38.37", "signal-hook-registry", "slab", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -423,9 +424,9 @@ checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de" [[package]] name = "async-trait" -version = "0.1.80" +version = "0.1.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" +checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" dependencies = [ "proc-macro2", "quote", @@ -540,17 +541,17 @@ dependencies = [ [[package]] name = "backtrace" -version = "0.3.73" +version = "0.3.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" +checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" dependencies = [ "addr2line", - "cc", "cfg-if", "libc", - "miniz_oxide 0.7.4", + "miniz_oxide 0.8.0", "object", "rustc-demangle", + "windows-targets 0.52.6", ] [[package]] @@ -594,9 +595,9 @@ checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "bitstream-io" -version = "2.5.0" +version = "2.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dcde5f311c85b8ca30c2e4198d4326bc342c76541590106f5fa4a50946ea499" +checksum = "b81e1519b0d82120d2fd469d5bfb2919a9361c48b02d82d04befc1cdd2002452" [[package]] name = "block" @@ -718,7 +719,7 @@ checksum = "b99da2f8558ca23c71f4fd15dc57c906239752dd27ff3c00a1d56b685b7cbfec" dependencies = [ "bitflags 2.6.0", "log", - "polling 3.7.2", + "polling 3.7.3", "rustix 0.38.37", "slab", "thiserror", @@ -747,9 +748,9 @@ dependencies = [ [[package]] name = "castaway" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a17ed5635fc8536268e5d4de1e22e81ac34419e5f052d4d51f4e01dcc263fcc" +checksum = "0abae9be0aaf9ea96a3b1b8b1b55c602ca751eba1b1500220cea4ecbafe7c0d5" dependencies = [ "rustversion", ] @@ -810,9 +811,9 @@ dependencies = [ [[package]] name = "clipboard-win" -version = "5.3.1" +version = "5.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79f4473f5144e20d9aceaf2972478f06ddf687831eafeeb434fbaf0acc4144ad" +checksum = "15efe7a882b08f34e38556b14f2fb3daa98769d06c7f0c1b076dfd0d983bc892" dependencies = [ "error-code", ] @@ -1024,9 +1025,9 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.12" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" +checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0" dependencies = [ "libc", ] @@ -1125,9 +1126,9 @@ checksum = "96a6ac251f4a2aca6b3f91340350eab87ae57c3f127ffeb585e92bd336717991" [[package]] name = "darling" -version = "0.20.9" +version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83b2eb4d90d12bdda5ed17de686c2acb4c57914f8f921b8da7e112b5a36f3fe1" +checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" dependencies = [ "darling_core", "darling_macro", @@ -1135,9 +1136,9 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.20.9" +version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "622687fe0bac72a04e5599029151f5796111b90f1baaa9b544d807a5e31cd120" +checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" dependencies = [ "fnv", "ident_case", @@ -1149,9 +1150,9 @@ dependencies = [ [[package]] name = "darling_macro" -version = "0.20.9" +version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "733cabb43482b1a1b53eee8583c2b9e8684d592215ea83efd305dd31bc2f0178" +checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core", "quote", @@ -1256,15 +1257,14 @@ dependencies = [ [[package]] name = "dunce" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b" +checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" [[package]] name = "ecolor" version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5629649a8ae57c73f175f4a96419905a8102cfbfcbce96ea25a826bbf468e990" +source = "git+https://github.com/emilk/egui?branch=master#59d71831fd43139bf9b427b779a241099b9c9826" dependencies = [ "bytemuck", "color-hex", @@ -1274,8 +1274,7 @@ dependencies = [ [[package]] name = "eframe" version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712634e63d86f5eb8e30f880bc4803b79dcc82539aec1a28fde86ed839daed24" +source = "git+https://github.com/emilk/egui?branch=master#59d71831fd43139bf9b427b779a241099b9c9826" dependencies = [ "ahash", "bytemuck", @@ -1284,7 +1283,7 @@ dependencies = [ "egui-wgpu", "egui-winit", "egui_glow", - "glow 0.14.0", + "glow 0.14.1", "glutin", "glutin-winit", "image", @@ -1309,8 +1308,7 @@ dependencies = [ [[package]] name = "egui" version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26bab3b3572566257a497b5f87d2cccaf7f7f122d4b8b620cba0493becc7955e" +source = "git+https://github.com/emilk/egui?branch=master#59d71831fd43139bf9b427b779a241099b9c9826" dependencies = [ "accesskit", "ahash", @@ -1323,8 +1321,7 @@ dependencies = [ [[package]] name = "egui-wgpu" version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba69456826abf572ed95b658b265c01f07a23d615d6f029eedc9ee5f13ddf788" +source = "git+https://github.com/emilk/egui?branch=master#59d71831fd43139bf9b427b779a241099b9c9826" dependencies = [ "ahash", "bytemuck", @@ -1342,8 +1339,7 @@ dependencies = [ [[package]] name = "egui-winit" version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "642c749bf221b5a3ecae3144c98b837729d87b9fde6c39a6ad00f07b71dbee94" +source = "git+https://github.com/emilk/egui?branch=master#59d71831fd43139bf9b427b779a241099b9c9826" dependencies = [ "accesskit_winit", "ahash", @@ -1411,8 +1407,7 @@ dependencies = [ [[package]] name = "egui_extras" version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9f1beb57a3c942fac2f058655188c79ac1cd200555e4f3684cd0c965ceb3a67" +source = "git+https://github.com/emilk/egui?branch=master#59d71831fd43139bf9b427b779a241099b9c9826" dependencies = [ "ahash", "egui", @@ -1445,13 +1440,12 @@ dependencies = [ [[package]] name = "egui_glow" version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea182206896187f7a2fcc207a1573785fc31330cb245f6cebcf663ea933f8d20" +source = "git+https://github.com/emilk/egui?branch=master#59d71831fd43139bf9b427b779a241099b9c9826" dependencies = [ "ahash", "bytemuck", "egui", - "glow 0.14.0", + "glow 0.14.1", "log", "memoffset 0.9.1", "wasm-bindgen", @@ -1611,8 +1605,7 @@ checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" [[package]] name = "emath" version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af86c4efae11da2a3dcbb4afebd0e9ed1916345e8d187b4051d443c8bd79af93" +source = "git+https://github.com/emilk/egui?branch=master#59d71831fd43139bf9b427b779a241099b9c9826" dependencies = [ "bytemuck", ] @@ -1671,8 +1664,7 @@ dependencies = [ [[package]] name = "epaint" version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "445e11ec86a4d85e1350578ba20b2d89977ed937f3faab32e1c3ec81d20c1842" +source = "git+https://github.com/emilk/egui?branch=master#59d71831fd43139bf9b427b779a241099b9c9826" dependencies = [ "ab_glyph", "ahash", @@ -1688,8 +1680,7 @@ dependencies = [ [[package]] name = "epaint_default_fonts" version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5202b64bef2b2c42a7f6e2e5b40fa83dd04aa61fdb08bfd116553adc149fe47a" +source = "git+https://github.com/emilk/egui?branch=master#59d71831fd43139bf9b427b779a241099b9c9826" [[package]] name = "equivalent" @@ -1709,9 +1700,9 @@ dependencies = [ [[package]] name = "error-code" -version = "3.2.0" +version = "3.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0474425d51df81997e2f90a21591180b38eccf27292d755f3e30750225c175b" +checksum = "a5d9305ccc6942a704f4335694ecd3de2ea531b114ac2d51f5f843750787a92f" [[package]] name = "event-listener" @@ -2211,9 +2202,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.29.0" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" +checksum = "32085ea23f3234fc7846555e85283ba4de91e21016dc0455a16286d87a292d64" [[package]] name = "gio" @@ -2331,9 +2322,9 @@ dependencies = [ [[package]] name = "glow" -version = "0.14.0" +version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f865cbd94bd355b89611211e49508da98a1fce0ad755c1e8448fb96711b24528" +checksum = "2f4a888dbe8181a7535853469c21c67ca9a1cea9460b16808fc018ea9e55d248" dependencies = [ "js-sys", "slotmap", @@ -2530,9 +2521,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa82e28a107a8cc405f0839610bdc9b15f1e25ec7d696aa5cf173edbcb1486ab" +checksum = "524e8ac6999421f49a846c2d4411f337e53497d8ec55d67753beffa43c5d9205" dependencies = [ "atomic-waker", "bytes", @@ -2736,15 +2727,15 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.27.2" +version = "0.27.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ee4be2c948921a1a5320b629c4193916ed787a7f7f293fd3f7f5a6c9de74155" +checksum = "08afdbb5c31130e3034af566421053ab03787c640246a446327f550d11bcb333" dependencies = [ "futures-util", "http", "hyper", "hyper-util", - "rustls 0.23.12", + "rustls", "rustls-pki-types", "tokio", "tokio-rustls", @@ -2769,9 +2760,9 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.6" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ab92f4f49ee4fb4f997c784b7a2e0fa70050211e0b6a287f898c3c9785ca956" +checksum = "41296eb09f183ac68eec06e03cdbea2e759633d4067b2f6552fc2e009bcad08b" dependencies = [ "bytes", "futures-channel", @@ -2782,7 +2773,6 @@ dependencies = [ "pin-project-lite", "socket2 0.5.7", "tokio", - "tower", "tower-service", "tracing", ] @@ -2904,9 +2894,9 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.9.0" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" +checksum = "187674a687eed5fe42285b40c6291f9a01517d415fad1c3cbc6a9f778af7fcd4" [[package]] name = "itertools" @@ -3053,9 +3043,9 @@ dependencies = [ [[package]] name = "libloading" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e310b3a6b5907f99202fcdb4960ff45b93735d7c7d96b760fcff8db2dc0e103d" +checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" dependencies = [ "cfg-if", "windows-targets 0.52.6", @@ -3152,9 +3142,9 @@ checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5" [[package]] name = "matchit" -version = "0.8.2" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "540f1c43aed89909c0cc0cc604e3bb2f7e7a341a3728a9e6cfe760e733cd11ed" +checksum = "47e1ffaa40ddd1f3ed91f717a33c8c0ee23fff369e3aa8772b9605cc1d22f4c3" [[package]] name = "maybe-rayon" @@ -3173,9 +3163,9 @@ checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "memmap2" -version = "0.9.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe751422e4a8caa417e13c3ea66452215d7d63e19e604f4980461212f3ae1322" +checksum = "fd3f7eed9d3848f8b98834af67102b720745c4ec028fcd0aa0239277e7de374f" dependencies = [ "libc", ] @@ -3441,18 +3431,18 @@ dependencies = [ [[package]] name = "num_enum" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02339744ee7253741199f897151b38e72257d13802d4ee837285cc2990a90845" +checksum = "4e613fc340b2220f734a8595782c551f1250e969d87d3be1ae0579e8d4065179" dependencies = [ "num_enum_derive", ] [[package]] name = "num_enum_derive" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "681030a937600a36906c185595136d26abfebb4aa9c65701cefcaf8578bb982b" +checksum = "af1844ef2428cc3e1cb900be36181049ef3d3193c63e43026cfe202983b27a56" dependencies = [ "proc-macro-crate 2.0.2", "proc-macro2", @@ -3693,9 +3683,9 @@ dependencies = [ [[package]] name = "object" -version = "0.36.3" +version = "0.36.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27b64972346851a39438c60b341ebc01bba47464ae329e55cf343eb93964efd9" +checksum = "084f1a5821ac4c651660a94a7153d27ac9d8a53736203f58b31945ded098070a" dependencies = [ "memchr", ] @@ -3771,9 +3761,9 @@ dependencies = [ [[package]] name = "owned_ttf_parser" -version = "0.21.0" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b41438d2fc63c46c74a2203bf5ccd82c41ba04347b2fcf5754f230b167067d5" +checksum = "490d3a563d3122bf7c911a59b0add9389e5ec0f5f0c3ac6b91ff235a0e6a7f90" dependencies = [ "ttf-parser", ] @@ -3785,7 +3775,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3621585028d2e217adcae08f9b42092790659d3a606edda6145e4e1eef044d6" dependencies = [ "httparse", - "rustls 0.23.12", + "rustls", "rustls-pki-types", "url", "webpki-roots", @@ -3818,9 +3808,9 @@ dependencies = [ [[package]] name = "parking" -version = "2.2.0" +version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb813b8af86854136c6922af0598d719255ecb2179515e6e7730d468f05c9cae" +checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" [[package]] name = "parking_lot" @@ -3840,7 +3830,7 @@ checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.5.4", + "redox_syscall 0.5.6", "smallvec", "windows-targets 0.52.6", ] @@ -3991,9 +3981,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "piper" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae1d5c74c9876f070d3e8fd503d748c7d974c3e48da8f41350fa5222ef9b4391" +checksum = "96c8c490f422ef9a4efd2cb5b42b76c8613d7e7dfc1caf667b8a3350a5acc066" dependencies = [ "atomic-waker", "fastrand 2.1.1", @@ -4037,9 +4027,9 @@ dependencies = [ [[package]] name = "polling" -version = "3.7.2" +version = "3.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3ed00ed3fbf728b5816498ecd316d1716eecaced9c0c8d2c5a6740ca214985b" +checksum = "cc2790cd301dec6cd3b7a025e4815cf825724a51c98dccfe6a3e55f05ffb6511" dependencies = [ "cfg-if", "concurrent-queue", @@ -4047,7 +4037,7 @@ dependencies = [ "pin-project-lite", "rustix 0.38.37", "tracing", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -4177,9 +4167,9 @@ checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" [[package]] name = "quick-xml" -version = "0.36.1" +version = "0.36.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96a05e2e8efddfa51a84ca47cec303fac86c8541b686d37cac5efc0e094417bc" +checksum = "f7649a7b4df05aed9ea7ec6f628c67c9953a43869b8bc50929569b2999d443fe" dependencies = [ "memchr", ] @@ -4360,18 +4350,18 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.4" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0884ad60e090bf1345b93da0a5de8923c93884cd03f40dfcfddd3b4bee661853" +checksum = "355ae415ccd3a04315d3f8246e86d67689ea74d88d915576e1589a351062a13b" dependencies = [ "bitflags 2.6.0", ] [[package]] name = "regex" -version = "1.10.5" +version = "1.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f" +checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" dependencies = [ "aho-corasick", "memchr", @@ -4483,9 +4473,9 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "rustc_version" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" dependencies = [ "semver", ] @@ -4519,25 +4509,13 @@ dependencies = [ [[package]] name = "rustls" -version = "0.22.4" +version = "0.23.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf4ef73721ac7bcd79b2b315da7779d8fc09718c6b3d2d1b2d94850eb8c18432" +checksum = "f2dabaac7466917e566adb06783a81ca48944c6898a1b08b9374106dd671f4c8" dependencies = [ "log", - "ring", - "rustls-pki-types", - "rustls-webpki", - "subtle", - "zeroize", -] - -[[package]] -name = "rustls" -version = "0.23.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c58f8c84392efc0a126acce10fa59ff7b3d2ac06ab451a33f2741989b806b044" -dependencies = [ "once_cell", + "ring", "rustls-pki-types", "rustls-webpki", "subtle", @@ -4546,9 +4524,9 @@ dependencies = [ [[package]] name = "rustls-pemfile" -version = "2.1.2" +version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29993a25686778eb88d4189742cd713c9bce943bc54251a33509dc63cbacf73d" +checksum = "196fe16b00e106300d3e45ecfcb764fa292a535d7326a29a5875c579c7417425" dependencies = [ "base64", "rustls-pki-types", @@ -4562,9 +4540,9 @@ checksum = "fc0a2ce646f8655401bb81e7927b812614bd5d91dbc968696be50603510fcaf0" [[package]] name = "rustls-webpki" -version = "0.102.6" +version = "0.102.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e6b52d4fda176fd835fdc55a835d4a89b8499cad995885a21149d5ad62f852e" +checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9" dependencies = [ "ring", "rustls-pki-types", @@ -4594,11 +4572,11 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.23" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" +checksum = "e9aaafd5a2b6e3d657ff009d82fbd630b6bd54dd4eb06f21693925cdf80f9b8b" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -4632,9 +4610,9 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.11.0" +version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c627723fd09706bacdb5cf41499e95098555af3c3c29d014dc3c458ef6be11c0" +checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" dependencies = [ "bitflags 2.6.0", "core-foundation 0.9.4", @@ -4645,9 +4623,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.11.0" +version = "2.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "317936bbbd05227752583946b9e66d7ce3b489f84e11a94a510b4437fef407d7" +checksum = "ea4a292869320c0272d7bc55a5a6aafaff59b4f63404a003887b679a2e05b4b6" dependencies = [ "core-foundation-sys", "libc", @@ -4724,9 +4702,9 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "0.6.7" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb5b1b31579f3811bf615c144393417496f152e12ac8b7663bf664f4a815306d" +checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" dependencies = [ "serde", ] @@ -5086,13 +5064,13 @@ dependencies = [ [[package]] name = "tao-macros" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec114582505d158b669b136e6851f85840c109819d77c42bb7c0709f727d18c2" +checksum = "f4e16beb8b2ac17db28eab8bca40e62dbfbb34c0fcdc6d9826b11b7b5d047dfd" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.77", ] [[package]] @@ -5262,16 +5240,16 @@ version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" dependencies = [ - "rustls 0.23.12", + "rustls", "rustls-pki-types", "tokio", ] [[package]] name = "tokio-util" -version = "0.7.11" +version = "0.7.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1" +checksum = "61e7c3654c13bcd040d4a03abee2c75b1d14a37b423cf5a813ceae1cc903ec6a" dependencies = [ "bytes", "futures-core", @@ -5325,32 +5303,11 @@ dependencies = [ "winnow", ] -[[package]] -name = "tower" -version = "0.4.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" -dependencies = [ - "futures-core", - "futures-util", - "pin-project", - "pin-project-lite", - "tokio", - "tower-layer", - "tower-service", -] - -[[package]] -name = "tower-layer" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" - [[package]] name = "tower-service" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" [[package]] name = "tracing" @@ -5391,9 +5348,9 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "ttf-parser" -version = "0.21.1" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c591d83f69777866b9126b24c6dd9a18351f177e49d625920d19f989fd31cf8" +checksum = "5be21190ff5d38e8b4a2d3b6a3ae57f612cc39c96e83cedeaf7abc338a8bac4a" [[package]] name = "type-map" @@ -5453,21 +5410,21 @@ dependencies = [ [[package]] name = "unicode-segmentation" -version = "1.11.0" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" +checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" [[package]] name = "unicode-width" -version = "0.1.13" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" +checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" [[package]] name = "unicode-xid" -version = "0.2.4" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" [[package]] name = "untrusted" @@ -5477,17 +5434,16 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "ureq" -version = "2.9.7" +version = "2.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d11a831e3c0b56e438a28308e7c810799e3c118417f342d30ecec080105395cd" +checksum = "b74fc6b57825be3373f7054754755f03ac3a8f5d70015ccad699ba2029956f4a" dependencies = [ "base64", "flate2", "log", "once_cell", - "rustls 0.22.4", + "rustls", "rustls-pki-types", - "rustls-webpki", "url", "webpki-roots", ] @@ -5538,9 +5494,9 @@ dependencies = [ [[package]] name = "validator_derive" -version = "0.18.1" +version = "0.18.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55591299b7007f551ed1eb79a684af7672c19c3193fb9e0a31936987bb2438ec" +checksum = "df0bcf92720c40105ac4b2dda2a4ea3aa717d4d6a862cc217da653a4bd5c6b10" dependencies = [ "darling", "once_cell", @@ -5711,9 +5667,9 @@ dependencies = [ [[package]] name = "wayland-cursor" -version = "0.31.3" +version = "0.31.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a206e8b2b53b1d3fcb9428fec72bc278ce539e2fa81fe2bfc1ab27703d5187b9" +checksum = "3a94697e66e76c85923b0d28a0c251e8f0666f58fc47d316c0f4da6da75d37cb" dependencies = [ "rustix 0.38.37", "wayland-client", @@ -5803,12 +5759,12 @@ dependencies = [ [[package]] name = "webbrowser" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "425ba64c1e13b1c6e8c5d2541c8fac10022ca584f33da781db01b5756aef1f4e" +checksum = "2e5f07fb9bc8de2ddfe6b24a71a75430673fd679e568c48b52716cef1cfae923" dependencies = [ "block2", - "core-foundation 0.9.4", + "core-foundation 0.10.0", "home", "jni", "log", @@ -5865,9 +5821,9 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.26.3" +version = "0.26.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd7c23921eeb1713a4e851530e9b9756e4fb0e89978582942612524cf09f01cd" +checksum = "841c67bff177718f1d4dfefde8d8f0e78f9b6589319ba88312f567fc5841a958" dependencies = [ "rustls-pki-types", ] @@ -5882,8 +5838,8 @@ dependencies = [ "webview2-com-sys", "windows 0.58.0", "windows-core 0.58.0", - "windows-implement 0.58.0", - "windows-interface 0.58.0", + "windows-implement", + "windows-interface", ] [[package]] @@ -6039,11 +5995,11 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b" +checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -6062,18 +6018,6 @@ dependencies = [ "windows-targets 0.52.6", ] -[[package]] -name = "windows" -version = "0.54.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9252e5725dbed82865af151df558e754e4a3c2c30818359eb17465f1346a1b49" -dependencies = [ - "windows-core 0.54.0", - "windows-implement 0.53.0", - "windows-interface 0.53.0", - "windows-targets 0.52.6", -] - [[package]] name = "windows" version = "0.58.0" @@ -6093,40 +6037,19 @@ dependencies = [ "windows-targets 0.52.6", ] -[[package]] -name = "windows-core" -version = "0.54.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12661b9c89351d684a50a8a643ce5f608e20243b9fb84687800163429f161d65" -dependencies = [ - "windows-result 0.1.2", - "windows-targets 0.52.6", -] - [[package]] name = "windows-core" version = "0.58.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ba6d44ec8c2591c134257ce647b7ea6b20335bf6379a27dac5f1641fcf59f99" dependencies = [ - "windows-implement 0.58.0", - "windows-interface 0.58.0", - "windows-result 0.2.0", + "windows-implement", + "windows-interface", + "windows-result", "windows-strings", "windows-targets 0.52.6", ] -[[package]] -name = "windows-implement" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "942ac266be9249c84ca862f0a164a39533dc2f6f33dc98ec89c8da99b82ea0bd" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.77", -] - [[package]] name = "windows-implement" version = "0.58.0" @@ -6138,17 +6061,6 @@ dependencies = [ "syn 2.0.77", ] -[[package]] -name = "windows-interface" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da33557140a288fae4e1d5f8873aaf9eb6613a9cf82c3e070223ff177f598b60" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.77", -] - [[package]] name = "windows-interface" version = "0.58.0" @@ -6166,20 +6078,11 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e400001bb720a623c1c69032f8e3e4cf09984deec740f007dd2b03ec864804b0" dependencies = [ - "windows-result 0.2.0", + "windows-result", "windows-strings", "windows-targets 0.52.6", ] -[[package]] -name = "windows-result" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e383302e8ec8515204254685643de10811af0ed97ea37210dc26fb0032647f8" -dependencies = [ - "windows-targets 0.52.6", -] - [[package]] name = "windows-result" version = "0.2.0" @@ -6195,7 +6098,7 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" dependencies = [ - "windows-result 0.2.0", + "windows-result", "windows-targets 0.52.6", ] @@ -6567,18 +6470,18 @@ checksum = "ec107c4503ea0b4a98ef47356329af139c0a4f7750e621cf2973cd3385ebcb3d" [[package]] name = "xcursor" -version = "0.3.5" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a0ccd7b4a5345edfcd0c3535718a4e9ff7798ffc536bb5b5a0e26ff84732911" +checksum = "0ef33da6b1660b4ddbfb3aef0ade110c8b8a781a3b6382fa5f2b5b040fd55f61" [[package]] name = "xdg-home" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca91dcf8f93db085f3a0a29358cd0b9d670915468f4290e8b85d118a34211ab8" +checksum = "ec1cdab258fb55c0da61328dc52c8764709b249011b2cad0454c72f0bf10a1f6" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -6602,9 +6505,9 @@ checksum = "b9cc00251562a284751c9973bace760d86c0276c471b4be569fe6b068ee97a56" [[package]] name = "xml-rs" -version = "0.8.20" +version = "0.8.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "791978798f0597cfc70478424c2b4fdc2b7a8024aaff78497ef00f24ef674193" +checksum = "af4e2e2f7cba5a093896c1e150fbfe177d1883e7448200efb81d40b9d339ef26" [[package]] name = "zbus" @@ -6760,18 +6663,3 @@ dependencies = [ "quote", "syn 1.0.109", ] - -[[patch.unused]] -name = "eframe" -version = "0.28.1" -source = "git+https://github.com/emilk/egui?branch=master#06f709481a4e5e74bec961544c77e9afcae265db" - -[[patch.unused]] -name = "egui" -version = "0.28.1" -source = "git+https://github.com/emilk/egui?branch=master#06f709481a4e5e74bec961544c77e9afcae265db" - -[[patch.unused]] -name = "egui_extras" -version = "0.28.1" -source = "git+https://github.com/emilk/egui?branch=master#06f709481a4e5e74bec961544c77e9afcae265db" From 4c16cc0768b864060b0512a4c711a341358fd8a6 Mon Sep 17 00:00:00 2001 From: Nicolas Date: Sun, 29 Sep 2024 00:11:19 +0200 Subject: [PATCH 14/16] review findings --- crates/egui_dnd/src/item.rs | 8 ++----- crates/egui_dnd/src/item_iterator.rs | 7 ++----- .../examples/flex_customize_example.rs | 3 +-- crates/egui_flex/src/lib.rs | 2 +- crates/egui_router/src/transition.rs | 21 +++++-------------- crates/egui_virtual_list/src/lib.rs | 6 +----- crates/hello_egui_utils/src/center.rs | 2 +- fancy-example/src/chat.rs | 6 +----- 8 files changed, 14 insertions(+), 41 deletions(-) diff --git a/crates/egui_dnd/src/item.rs b/crates/egui_dnd/src/item.rs index 5aea6b4..588281b 100644 --- a/crates/egui_dnd/src/item.rs +++ b/crates/egui_dnd/src/item.rs @@ -176,7 +176,7 @@ impl<'a> Item<'a> { rect.min }; - let mut child = ui.new_child(UiBuilder::new().max_rect(rect).layout(*ui.layout())); + let mut child = ui.new_child(UiBuilder::new().max_rect(rect)); child.allocate_new_ui( UiBuilder::new().max_rect(Rect::from_min_size(position, rect.size())), @@ -216,11 +216,7 @@ impl<'a> Item<'a> { let size = ui.available_size(); - let mut child = ui.new_child( - UiBuilder::new() - .max_rect(ui.max_rect()) - .layout(*ui.layout()), - ); + let mut child = ui.new_child(UiBuilder::new().max_rect(ui.max_rect())); let response = child.allocate_new_ui( UiBuilder::new().max_rect(Rect::from_min_size(position, size)), |ui| { diff --git a/crates/egui_dnd/src/item_iterator.rs b/crates/egui_dnd/src/item_iterator.rs index fa615fc..e892f03 100644 --- a/crates/egui_dnd/src/item_iterator.rs +++ b/crates/egui_dnd/src/item_iterator.rs @@ -110,11 +110,8 @@ impl<'a> ItemIterator<'a> { ); let rect = if is_dragged_item { if let Some((_id, pos)) = self.hovering_item { - let mut child = ui.new_child( - UiBuilder::new() - .max_rect(ui.available_rect_before_wrap()) - .layout(*ui.layout()), - ); + let mut child = + ui.new_child(UiBuilder::new().max_rect(ui.available_rect_before_wrap())); let start = ui.next_widget_position(); let rect = child .allocate_new_ui( diff --git a/crates/egui_flex/examples/flex_customize_example.rs b/crates/egui_flex/examples/flex_customize_example.rs index 2b0f8e1..da6f22f 100644 --- a/crates/egui_flex/examples/flex_customize_example.rs +++ b/crates/egui_flex/examples/flex_customize_example.rs @@ -105,7 +105,7 @@ impl Default for Demo { } } -fn main() { +fn main() -> eframe::Result<()> { let mut demo = Demo::default(); eframe::run_simple_native( "flex custom", @@ -122,5 +122,4 @@ fn main() { }); }, ) - .unwrap(); } diff --git a/crates/egui_flex/src/lib.rs b/crates/egui_flex/src/lib.rs index 93725ab..f882fc9 100644 --- a/crates/egui_flex/src/lib.rs +++ b/crates/egui_flex/src/lib.rs @@ -744,7 +744,7 @@ impl FlexContainerUi { let child_rect = content_rect.intersect(ui.max_rect()); - let mut child = ui.new_child(UiBuilder::new().max_rect(child_rect).layout(*ui.layout())); + let mut child = ui.new_child(UiBuilder::new().max_rect(child_rect)); let r = content(&mut child); diff --git a/crates/egui_router/src/transition.rs b/crates/egui_router/src/transition.rs index 1c17ede..45d36a7 100644 --- a/crates/egui_router/src/transition.rs +++ b/crates/egui_router/src/transition.rs @@ -16,12 +16,7 @@ pub trait ComposableTransitionTrait { impl TransitionTrait for T { fn create_child_ui(&self, ui: &mut Ui, t: f32, with_id: Id) -> Ui { - let mut child = ui.new_child( - UiBuilder::new() - .max_rect(ui.max_rect()) - .layout(*ui.layout()) - .id_salt(with_id), - ); + let mut child = ui.new_child(UiBuilder::new().max_rect(ui.max_rect()).id_salt(with_id)); self.apply(&mut child, t); child } @@ -101,12 +96,7 @@ impl TransitionTrait for SlideTransition { let offset = available_size * (1.0 - t) * self.amount; let child_rect = ui.max_rect().translate(offset); - ui.new_child( - UiBuilder::new() - .max_rect(child_rect) - .layout(*ui.layout()) - .id_salt(with_id), - ) + ui.new_child(UiBuilder::new().max_rect(child_rect).id_salt(with_id)) } } @@ -210,7 +200,7 @@ impl ActiveTransition { &mut self, ui: &mut Ui, state: &mut State, - (in_id, contentin_): (usize, impl FnOnce(&mut Ui, &mut State)), + (in_id, content_in): (usize, impl FnOnce(&mut Ui, &mut State)), content_out: Option<(usize, impl FnOnce(&mut Ui, &mut State))>, ) -> ActiveTransitionResult { let dt = ui.input(|i| i.stable_dt); @@ -227,7 +217,7 @@ impl ActiveTransition { (self.easing)(t), Id::new("router_child").with(in_id), ); - contentin_(&mut out_ui, state); + content_in(&mut out_ui, state); }); if let Some((out_id, content_out)) = content_out { @@ -258,7 +248,7 @@ impl ActiveTransition { (self.easing)(t), Id::new("router_child").with(in_id), ); - contentin_(&mut in_ui, state); + content_in(&mut in_ui, state); }); } @@ -274,7 +264,6 @@ impl ActiveTransition { let mut ui = ui.new_child( UiBuilder::new() .max_rect(ui.max_rect()) - .layout(*ui.layout()) .id_salt(Id::new("router_child").with(with_id)), ); content(&mut ui); diff --git a/crates/egui_virtual_list/src/lib.rs b/crates/egui_virtual_list/src/lib.rs index 416bd2c..27c4806 100644 --- a/crates/egui_virtual_list/src/lib.rs +++ b/crates/egui_virtual_list/src/lib.rs @@ -170,11 +170,7 @@ impl VirtualList { // to maintain the scroll position let scroll_items_top_step_2 = if let Some(scroll_top_items) = self.items_inserted_at_start.take() { - let mut measure_ui = ui.new_child( - UiBuilder::new() - .max_rect(ui.max_rect()) - .layout(*ui.layout()), - ); + let mut measure_ui = ui.new_child(UiBuilder::new().max_rect(ui.max_rect())); measure_ui.set_invisible(); let start_height = measure_ui.next_widget_position(); diff --git a/crates/hello_egui_utils/src/center.rs b/crates/hello_egui_utils/src/center.rs index ed8d2b6..e16eb40 100644 --- a/crates/hello_egui_utils/src/center.rs +++ b/crates/hello_egui_utils/src/center.rs @@ -48,7 +48,7 @@ impl Center { rect }; - let mut ui = ui.new_child(UiBuilder::new().max_rect(content_rect).layout(*ui.layout())); + let mut ui = ui.new_child(UiBuilder::new().max_rect(content_rect)); if last_size.is_none() { ui.set_invisible(); diff --git a/fancy-example/src/chat.rs b/fancy-example/src/chat.rs index b65c8cf..7910a8b 100644 --- a/fancy-example/src/chat.rs +++ b/fancy-example/src/chat.rs @@ -213,11 +213,7 @@ impl ChatExample { // chat bubble layout where the own bubbles are right-aligned and // the text within is left-aligned. let (_pos, galley, _response) = label.layout_in_ui( - &mut ui.new_child( - UiBuilder::new() - .max_rect(ui.max_rect()) - .layout(*ui.layout()), - ), + &mut ui.new_child(UiBuilder::new().max_rect(ui.max_rect())), ); let rect = galley.rect; // Calculate the width of the frame based on the width of From 2d85de60185ba5336f5eb0c3ec3a60a5727836fe Mon Sep 17 00:00:00 2001 From: Nicolas Date: Sun, 29 Sep 2024 00:12:52 +0200 Subject: [PATCH 15/16] enable CI in PR`s --- .github/workflows/check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 31febeb..d4df2b1 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -1,6 +1,6 @@ name: CI -on: [push] +on: [push, pull_request] env: CARGO_TERM_COLOR: always From 02ac70183d8ad01b856daa5e1fbeb330d480a965 Mon Sep 17 00:00:00 2001 From: Nicolas Date: Sun, 29 Sep 2024 00:20:03 +0200 Subject: [PATCH 16/16] fix tests --- crates/egui_form/README.md | 7 ++----- crates/egui_form/src/garde.rs | 2 +- crates/egui_form/src/lib.rs | 2 +- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/crates/egui_form/README.md b/crates/egui_form/README.md index 0d9b788..ff02721 100644 --- a/crates/egui_form/README.md +++ b/crates/egui_form/README.md @@ -6,11 +6,8 @@ [![unsafe forbidden](https://img.shields.io/badge/unsafe-forbidden-success.svg)](https://github.com/rust-secure-code/safety-dance/) [![License](https://img.shields.io/crates/l/egui_form.svg)](https://crates.io/crates/egui_form) - - [content]:<> - egui_form adds form validation to egui. It can either use [validator](https://crates.io/crates/validator) or [garde](https://crates.io/crates/garde) for validation. @@ -61,7 +58,7 @@ struct Fields { } fn form_ui(ui: &mut Ui, fields: &mut Fields) { - let mut form = Form::new().add_report(GardeReport::new(fields.validate(&()))); + let mut form = Form::new().add_report(GardeReport::new(fields.validate())); FormField::new(&mut form, field_path!("user_name")) .label("User Name") @@ -71,4 +68,4 @@ fn form_ui(ui: &mut Ui, fields: &mut Fields) { println!("Submitted: {:?}", fields); } } -``` \ No newline at end of file +``` diff --git a/crates/egui_form/src/garde.rs b/crates/egui_form/src/garde.rs index b693810..b468269 100644 --- a/crates/egui_form/src/garde.rs +++ b/crates/egui_form/src/garde.rs @@ -54,7 +54,7 @@ impl GardeReport { /// tags: vec!["tag1".to_string(), "waaaaytooooloooong".to_string()], /// }; /// - /// let report = GardeReport::new(test.validate(&())); + /// let report = GardeReport::new(test.validate()); /// /// assert!(report /// .get_field_error(field_path!("user_name").into_field_path()) diff --git a/crates/egui_form/src/lib.rs b/crates/egui_form/src/lib.rs index e4a7514..5e75e25 100644 --- a/crates/egui_form/src/lib.rs +++ b/crates/egui_form/src/lib.rs @@ -39,7 +39,7 @@ mod form; /// /// pub fn form_ui(ui: &mut egui::Ui, test: &mut Test) { /// let mut form = -/// Form::new().add_report(egui_form::garde::GardeReport::new(test.validate(&()))); +/// Form::new().add_report(egui_form::garde::GardeReport::new(test.validate())); /// /// FormField::new(&mut form, field_path!("user_name")) /// .label("User Name")