MCPcopy Create free account
hub / github.com/elastic/devfiler / gui_thread

Function gui_thread

src/ui/mod.rs:26–61  ·  view source on GitHub ↗
(collector: crate::collector::Collector)

Source from the content-addressed store, hash-verified

24static ICON_BYTES: &[u8] = include_bytes!("../../assets/icon.png");
25
26pub fn gui_thread(collector: crate::collector::Collector) -> Result<(), eframe::Error> {
27 let icon = eframe::icon_data::from_png_bytes(ICON_BYTES);
28 let icon = icon.expect("corrupted icon");
29
30 let options = eframe::NativeOptions {
31 viewport: egui::ViewportBuilder::default()
32 .with_icon(icon)
33 .with_inner_size([1500., 900.]),
34 ..Default::default()
35 };
36
37 let mut title_exts = Vec::new();
38 if cfg!(debug_assertions) {
39 title_exts.push("debug build, slow!".to_owned());
40 }
41 let title_ext = if !title_exts.is_empty() {
42 format!(" ({})", title_exts.join(" "))
43 } else {
44 String::new()
45 };
46
47 eframe::run_native(
48 &format!(
49 "Elastic devfiler v{}{}",
50 env!("CARGO_PKG_VERSION"),
51 title_ext,
52 ),
53 options,
54 Box::new(move |cc| {
55 egui_extras::install_image_loaders(&cc.egui_ctx);
56 load_phosphor_icons(&cc.egui_ctx);
57 tokio::spawn(background_ui_waker(cc.egui_ctx.clone()));
58 Ok(Box::new(app::DevfilerUi::new(collector)))
59 }),
60 )
61}
62
63async fn background_ui_waker(ctx: egui::Context) {
64 let mut db_watcher = crate::storage::UpdateWatcher::default();

Callers 1

mainFunction · 0.85

Calls 2

load_phosphor_iconsFunction · 0.85
background_ui_wakerFunction · 0.85

Tested by

no test coverage detected