diff --git a/src/dialog.rs b/src/dialog.rs index 947e0fa..32d7c7e 100644 --- a/src/dialog.rs +++ b/src/dialog.rs @@ -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>>); @@ -802,7 +810,7 @@ impl MakeWidget for FilePickerWidget { cb.invoke(chosen_path.clone()); } }) - .with_no(|| {}) + .with_no(()) .finish() .open(&self.handle); return;