Skip to content

Commit 8e89fdb

Browse files
authored
Merge pull request #45 from dmackdev/update-egui
update egui to 0.32
2 parents e5693b2 + b6ca760 commit 8e89fdb

File tree

15 files changed

+41
-49
lines changed

15 files changed

+41
-49
lines changed

Cargo.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
name = "egui_json_tree"
33
version = "0.11.0"
44
authors = ["Duncan MacKinnon <[email protected]>"]
5-
edition = "2021"
5+
edition = "2024"
6+
rust-version = "1.85"
67
description = "An interactive JSON tree visualiser for egui, with search and highlight functionality."
78
repository = "https://github.com/dmackdev/egui_json_tree"
89
license = "MIT OR Apache-2.0"
@@ -11,12 +12,12 @@ categories = ["gui", "visualization"]
1112
include = ["src/*.rs", "LICENSE-MIT", "LICENSE-APACHE", "Cargo.toml"]
1213

1314
[dependencies]
14-
egui = { version = "0.31", default-features = false }
15+
egui = { version = "0.32", default-features = false }
1516
serde_json = { version = "1", optional = true }
1617
simd-json = { version = "0.13", optional = true }
1718

1819
[dev-dependencies]
19-
eframe = "0.31"
20+
eframe = "0.32"
2021

2122
[features]
2223
default = ["serde_json"]

examples/demo/Cargo.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22
name = "demo"
33
version = "0.1.0"
44
authors = ["Duncan MacKinnon <[email protected]>"]
5-
edition = "2021"
5+
edition = "2024"
6+
rust-version = "1.85"
67
license = "MIT OR Apache-2.0"
78
publish = false
89

910
[dependencies]
10-
eframe = "0.31"
11-
egui = { version = "0.31", default-features = false }
11+
eframe = "0.32"
12+
egui = { version = "0.32", default-features = false }
1213
egui_json_tree = { path = "../../" }
1314
serde_json = { version = "1" }
1415

examples/demo/src/apps/copy_to_clipboard.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use egui::{CursorIcon, Ui};
2-
use egui_json_tree::{render::DefaultRender, JsonTree};
2+
use egui_json_tree::{JsonTree, render::DefaultRender};
33
use serde_json::Value;
44

55
use super::Show;
@@ -34,15 +34,13 @@ impl Show for CopyToClipboardExample {
3434
if !pointer.is_empty() && ui.button("Copy path").clicked() {
3535
println!("{}", pointer);
3636
ui.ctx().copy_text(pointer);
37-
ui.close_menu();
3837
}
3938

4039
if ui.button("Copy contents").clicked() {
4140
if let Ok(pretty_str) = serde_json::to_string_pretty(context.value()) {
4241
println!("{}", pretty_str);
4342
ui.ctx().copy_text(pretty_str);
4443
}
45-
ui.close_menu();
4644
}
4745
});
4846
})

examples/demo/src/apps/custom_input.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use egui::{RichText, Ui};
22
use egui_json_tree::JsonTree;
3-
use serde_json::{json, Value};
3+
use serde_json::{Value, json};
44

55
use super::Show;
66

examples/demo/src/apps/editor.rs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
use std::str::FromStr;
22

33
use egui::{
4+
CursorIcon, Margin, TextEdit, Ui,
45
text::{CCursor, CCursorRange},
5-
vec2, CursorIcon, Margin, TextEdit, Ui,
6+
vec2,
67
};
78
use egui_json_tree::{
9+
DefaultExpand, JsonTree, JsonTreeStyle, ToggleButtonsState,
810
delimiters::ExpandableDelimiter,
911
pointer::JsonPointerSegment,
1012
render::{
1113
DefaultRender, RenderBaseValueContext, RenderContext, RenderExpandableDelimiterContext,
1214
RenderPropertyContext,
1315
},
14-
DefaultExpand, JsonTree, JsonTreeStyle, ToggleButtonsState,
1516
};
1617
use serde_json::Value;
1718

@@ -167,7 +168,6 @@ impl Editor {
167168
if let Some(state) = context.collapsing_state.as_mut() {
168169
state.set_open(true);
169170
}
170-
ui.close_menu();
171171
}
172172

173173
if context.value.is_array() && ui.button("Add to array").clicked() {
@@ -177,7 +177,6 @@ impl Editor {
177177
if let Some(state) = context.collapsing_state.as_mut() {
178178
state.set_open(true);
179179
}
180-
ui.close_menu();
181180
}
182181

183182
if let Some(parent) = context.pointer.parent() {
@@ -190,7 +189,6 @@ impl Editor {
190189
request_focus: true,
191190
is_new_key: false,
192191
}));
193-
ui.close_menu()
194192
}
195193
}
196194

@@ -206,7 +204,6 @@ impl Editor {
206204
},
207205
};
208206
self.edit_events.push(event);
209-
ui.close_menu();
210207
}
211208
}
212209
});
@@ -227,7 +224,6 @@ impl Editor {
227224
new_value_input: context.value.to_string(),
228225
request_focus: true,
229226
}));
230-
ui.close_menu();
231227
}
232228

233229
match (context.pointer.parent(), context.pointer.last()) {
@@ -237,7 +233,6 @@ impl Editor {
237233
object_pointer: parent.to_json_pointer_string(),
238234
key: key.to_string(),
239235
});
240-
ui.close_menu();
241236
}
242237
}
243238
(Some(parent), Some(JsonPointerSegment::Index(idx))) => {
@@ -246,7 +241,6 @@ impl Editor {
246241
array_pointer: parent.to_json_pointer_string(),
247242
idx: *idx,
248243
});
249-
ui.close_menu();
250244
}
251245
}
252246
_ => {}
@@ -273,7 +267,6 @@ impl Editor {
273267
pointer: context.pointer.to_json_pointer_string(),
274268
});
275269
context.collapsing_state.set_open(true);
276-
ui.close_menu();
277270
}
278271
});
279272
}
@@ -290,7 +283,6 @@ impl Editor {
290283
pointer: context.pointer.to_json_pointer_string(),
291284
});
292285
context.collapsing_state.set_open(true);
293-
ui.close_menu();
294286
}
295287
});
296288
}

examples/demo/src/apps/wrapping.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ impl WrappingExample {
100100
{
101101
self.wrap.max_width = JsonTreeMaxWidth::Points(100.0);
102102
}
103-
if let JsonTreeMaxWidth::Points(ref mut pts) = &mut self.wrap.max_width {
103+
if let JsonTreeMaxWidth::Points(pts) = &mut self.wrap.max_width {
104104
ui.add(DragValue::new(pts).speed(10.0).range(100.0..=10000.0));
105105
}
106106
});

examples/demo/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use apps::{
2-
copy_to_clipboard::CopyToClipboardExample, custom_input::CustomExample,
2+
Example, Show, copy_to_clipboard::CopyToClipboardExample, custom_input::CustomExample,
33
editor::JsonEditorExample, search::SearchExample,
4-
toggle_buttons::ToggleButtonsCustomisationDemo, wrapping::WrappingExample, Example, Show,
4+
toggle_buttons::ToggleButtonsCustomisationDemo, wrapping::WrappingExample,
55
};
66
use serde_json::json;
77

rust-toolchain.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
# to the user in the error, instead of "error: invalid channel name '[toolchain]'".
66

77
[toolchain]
8-
channel = "1.81.0"
8+
channel = "1.85.0"
99
components = ["rustfmt", "clippy"]
1010
targets = ["wasm32-unknown-unknown"]

src/node.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
use std::collections::HashSet;
22

33
use egui::{
4-
collapsing_header::{paint_default_icon, CollapsingState},
54
Id, Ui,
5+
collapsing_header::{CollapsingState, paint_default_icon},
66
};
77

88
use crate::{
9-
delimiters::{SpacingDelimiter, ARRAY_DELIMITERS, OBJECT_DELIMITERS},
9+
DefaultExpand, JsonTree, JsonTreeStyle, ToggleButtonsState,
10+
delimiters::{ARRAY_DELIMITERS, OBJECT_DELIMITERS, SpacingDelimiter},
1011
pointer::{JsonPointer, JsonPointerSegment},
1112
render::{
1213
JsonTreeRenderer, ParentStatus, RenderBaseValueContext, RenderExpandableDelimiterContext,
@@ -15,7 +16,6 @@ use crate::{
1516
response::JsonTreeResponse,
1617
search::SearchTerm,
1718
value::{ExpandableType, JsonTreeValue, ToJsonTreeValue},
18-
DefaultExpand, JsonTree, JsonTreeStyle, ToggleButtonsState,
1919
};
2020

2121
pub(crate) struct JsonTreeNode<'a, 'b, T: ToJsonTreeValue> {

src/pointer.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::fmt;
66
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
77
pub struct JsonPointer<'a, 'b>(pub(crate) &'b [JsonPointerSegment<'a>]);
88

9-
impl<'a, 'b> JsonPointer<'a, 'b> {
9+
impl<'a> JsonPointer<'a, '_> {
1010
/// Returns a JSON Pointer string that can be used to look up specific values within a JSON document, where:
1111
/// - The whole document is identified by the empty string `""`.
1212
/// - A pointer string to a value within the document starts with `/`.
@@ -43,7 +43,7 @@ pub enum JsonPointerSegment<'a> {
4343
Key(&'a str),
4444
}
4545

46-
impl<'a> fmt::Display for JsonPointerSegment<'a> {
46+
impl fmt::Display for JsonPointerSegment<'_> {
4747
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
4848
match self {
4949
JsonPointerSegment::Key(key) => write!(f, "{}", key),
@@ -52,7 +52,7 @@ impl<'a> fmt::Display for JsonPointerSegment<'a> {
5252
}
5353
}
5454

55-
impl<'a> JsonPointerSegment<'a> {
55+
impl JsonPointerSegment<'_> {
5656
pub fn to_json_pointer_segment_string(&self) -> String {
5757
match self {
5858
JsonPointerSegment::Key(key) => {

0 commit comments

Comments
 (0)