From e66120b9c1d3998085de7422edaac778e4ebf3e3 Mon Sep 17 00:00:00 2001 From: Jonas Matser Date: Tue, 1 Dec 2020 14:28:40 +0100 Subject: [PATCH] Fix failing doctests --- native/src/widget/button.rs | 12 +++++++++++- web/src/widget/button.rs | 8 +++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/native/src/widget/button.rs b/native/src/widget/button.rs index c9b9df58..5d0940ec 100644 --- a/native/src/widget/button.rs +++ b/native/src/widget/button.rs @@ -33,8 +33,18 @@ use std::hash::Hash; /// Buttons can be disabled by not having an on_press. /// /// ``` +/// # use iced_native::{button, Text}; +/// # +/// # type Button<'a, Message> = +/// # iced_native::Button<'a, Message, iced_native::renderer::Null>; +/// # +/// # #[derive(Clone)] +/// # enum Message { +/// # ButtonPressed, +/// # } +/// # /// let mut state = button::State::new(); -/// let disabled_button = Button::new(&mut state, Text::new("I'm disabled!")); +/// let disabled_button = Button::::new(&mut state, Text::new("I'm disabled!")); /// ``` #[allow(missing_debug_implementations)] pub struct Button<'a, Message, Renderer: self::Renderer> { diff --git a/web/src/widget/button.rs b/web/src/widget/button.rs index 7c8612f6..6afcaee3 100644 --- a/web/src/widget/button.rs +++ b/web/src/widget/button.rs @@ -24,8 +24,14 @@ use dodrio::bumpalo; /// Buttons can be disabled by not having an on_press. /// /// ``` +/// # use iced_web::{button, Button, Text}; +/// # +/// # enum Message { +/// # ButtonPressed, +/// # } +/// # /// let mut state = button::State::new(); -/// let disabled_button = Button::new(&mut state, Text::new("I'm disabled!")); +/// let disabled_button = Button::::new(&mut state, Text::new("I'm disabled!")); /// ``` #[allow(missing_debug_implementations)]