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 traits for egui::Ui

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 the given future when clicked. Also sets up automatic refreshing every secs seconds. 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 seconds ago, in which case it does nothing. This is to prevent spamming the refresh button.

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§