() -> MessageButton

This commit is contained in:
Jonathan Johnson 2024-10-04 10:57:00 -07:00
parent 43a24501f9
commit 77f1bd46f7
No known key found for this signature in database
GPG key ID: A66D6A34D6620579

View file

@ -44,6 +44,8 @@ enum MessageButtonsKind {
/// dismisses the message box.
/// - `FnMut()` implementors: A button with the default caption given its
/// context that invokes the closure when chosen.
/// - `()`: The default button for this context. Equivalent to
/// `MessageButton::default()`.
///
/// To create a button with a custom caption that invokes a closure when chosen,
/// use [`MessageButton::custom`].
@ -99,6 +101,12 @@ where
}
}
impl From<()> for MessageButton {
fn from(_value: ()) -> Self {
Self::default()
}
}
#[derive(Clone, Debug, Default)]
struct OptionalCallback(Arc<Mutex<Option<OnceCallback>>>);
@ -802,7 +810,7 @@ impl MakeWidget for FilePickerWidget {
cb.invoke(chosen_path.clone());
}
})
.with_no(|| {})
.with_no(())
.finish()
.open(&self.handle);
return;