UiExt

Trait UiExt 

Source
pub trait UiExt {
    // Required methods
    fn popup_error(&self, error: &str) -> bool;
    fn popup_notify(&self, info: &str) -> bool;
    fn refresh_button<T, E, Fut>(
        &mut self,
        bind: &mut Bind<T, E>,
        f: impl FnOnce() -> Fut,
        secs: f64,
    )
       where Fut: Future<Output = Result<T, E>> + MaybeSend + 'static,
             T: MaybeSend + 'static,
             E: MaybeSend + 'static;
}
Expand description

Extension trait for egui::Ui providing convenient UI widgets.

Required Methods§

Source

fn popup_error(&self, error: &str) -> bool

Pops up an error window with the given error message.

§Returns

true if the “Retry” button was clicked.

Source

fn popup_notify(&self, info: &str) -> bool

Pops up a notification window with the given info message.

§Returns

true if the “Ok” button was clicked.

Source

fn refresh_button<T, E, Fut>( &mut self, bind: &mut Bind<T, E>, f: impl FnOnce() -> Fut, secs: f64, )
where Fut: Future<Output = Result<T, E>> + MaybeSend + 'static, T: MaybeSend + 'static, E: MaybeSend + 'static,

Adds a refresh button that triggers a new future when clicked.

This widget also handles periodic refreshing.

The button shows a tooltip with the time remaining until the next automatic refresh. If the button is clicked, it triggers an immediate refresh, unless the last refresh was less than secs / 4.0 seconds ago to prevent spamming.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl UiExt for Ui

Source§

fn popup_error(&self, error: &str) -> bool

Source§

fn popup_notify(&self, info: &str) -> bool

Source§

fn refresh_button<T, E, Fut>( &mut self, bind: &mut Bind<T, E>, f: impl FnOnce() -> Fut, secs: f64, )
where Fut: Future<Output = Result<T, E>> + MaybeSend + 'static, T: MaybeSend + 'static, E: MaybeSend + 'static,

Implementors§