egui_async/
lib.rs

1#![doc = include_str!("../README.md")]
2#![forbid(unsafe_code)]
3#![deny(missing_docs)]
4
5pub mod bind;
6
7pub use bind::{Bind, State, StateWithData};
8
9#[cfg(feature = "egui")]
10pub mod egui;
11
12#[cfg(feature = "egui")]
13pub use egui::{EguiAsyncPlugin, UiExt};
14
15/// A macro to run initialization code only once, even in the presence of multiple threads.
16/// Returns `true` if the code was executed in this call, `false` otherwise.
17#[macro_export]
18macro_rules! run_once {
19    { $($tokens:tt)* } => {{
20        static INIT_ONCE_BLOCK_: std::sync::Once = std::sync::Once::new();
21        let mut init_once_block_executed = false;
22        INIT_ONCE_BLOCK_.call_once(|| {
23            $($tokens)*
24            init_once_block_executed = true;
25        });
26        init_once_block_executed
27    }};
28}