pub struct AsyncButton<'a, T, E> { /* private fields */ }Expand description
A button that initiates an asynchronous operation when clicked.
It automatically disables itself and swaps its display text to a spinner to prevent double-submissions and indicate work is being done.
Implementations§
Source§impl<'a, T, E> AsyncButton<'a, T, E>
impl<'a, T, E> AsyncButton<'a, T, E>
Sourcepub fn new(bind: &'a mut Bind<T, E>, text: impl Into<WidgetText>) -> Self
pub fn new(bind: &'a mut Bind<T, E>, text: impl Into<WidgetText>) -> Self
Creates a new AsyncButton.
Sourcepub fn pending_text(self, text: impl Into<WidgetText>) -> Self
pub fn pending_text(self, text: impl Into<WidgetText>) -> Self
Sets the text to display next to the spinner while the operation is pending.
Sourcepub const fn frame(self, frame: bool) -> Self
pub const fn frame(self, frame: bool) -> Self
If set to false, the button will be rendered as plain text without a background frame,
similar to a clickable hyperlink label.
Sourcepub const fn clear_on_click(self, clear: bool) -> Self
pub const fn clear_on_click(self, clear: bool) -> Self
If set to true (default), the button will immediately clear the Bind’s previous
data upon being clicked. If false, the old data will remain accessible via .read()
while the new fetch is pending.
Auto Trait Implementations§
impl<'a, T, E> Freeze for AsyncButton<'a, T, E>
impl<'a, T, E> !RefUnwindSafe for AsyncButton<'a, T, E>
impl<'a, T, E> Send for AsyncButton<'a, T, E>
impl<'a, T, E> Sync for AsyncButton<'a, T, E>
impl<'a, T, E> Unpin for AsyncButton<'a, T, E>
impl<'a, T, E> UnsafeUnpin for AsyncButton<'a, T, E>
impl<'a, T, E> !UnwindSafe for AsyncButton<'a, T, E>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more