diff options
Diffstat (limited to '')
| -rw-r--r-- | web/src/widget/button.rs | 4 | ||||
| -rw-r--r-- | web/src/widget/checkbox.rs | 21 | ||||
| -rw-r--r-- | web/src/widget/container.rs | 4 | ||||
| -rw-r--r-- | web/src/widget/progress_bar.rs | 12 | ||||
| -rw-r--r-- | web/src/widget/radio.rs | 21 | ||||
| -rw-r--r-- | web/src/widget/scrollable.rs | 11 | ||||
| -rw-r--r-- | web/src/widget/slider.rs | 11 | ||||
| -rw-r--r-- | web/src/widget/text_input.rs | 9 | 
8 files changed, 54 insertions, 39 deletions
| diff --git a/web/src/widget/button.rs b/web/src/widget/button.rs index cd450b55..88137607 100644 --- a/web/src/widget/button.rs +++ b/web/src/widget/button.rs @@ -51,7 +51,7 @@ pub struct Button<'a, Message> {      #[allow(dead_code)]      min_height: u32,      padding: Padding, -    style: Box<dyn StyleSheet>, +    style: Box<dyn StyleSheet + 'a>,  }  impl<'a, Message> Button<'a, Message> { @@ -104,7 +104,7 @@ impl<'a, Message> Button<'a, Message> {      }      /// Sets the style of the [`Button`]. -    pub fn style(mut self, style: impl Into<Box<dyn StyleSheet>>) -> Self { +    pub fn style(mut self, style: impl Into<Box<dyn StyleSheet + 'a>>) -> Self {          self.style = style.into();          self      } diff --git a/web/src/widget/checkbox.rs b/web/src/widget/checkbox.rs index 43110aa7..844bf862 100644 --- a/web/src/widget/checkbox.rs +++ b/web/src/widget/checkbox.rs @@ -24,17 +24,17 @@ use std::rc::Rc;  ///  ///   #[allow(missing_debug_implementations)] -pub struct Checkbox<Message> { +pub struct Checkbox<'a, Message> {      is_checked: bool,      on_toggle: Rc<dyn Fn(bool) -> Message>,      label: String,      id: Option<String>,      width: Length,      #[allow(dead_code)] -    style: Box<dyn StyleSheet>, +    style_sheet: Box<dyn StyleSheet + 'a>,  } -impl<Message> Checkbox<Message> { +impl<'a, Message> Checkbox<'a, Message> {      /// Creates a new [`Checkbox`].      ///      /// It expects: @@ -53,7 +53,7 @@ impl<Message> Checkbox<Message> {              label: label.into(),              id: None,              width: Length::Shrink, -            style: Default::default(), +            style_sheet: Default::default(),          }      } @@ -64,8 +64,11 @@ impl<Message> Checkbox<Message> {      }      /// Sets the style of the [`Checkbox`]. -    pub fn style(mut self, style: impl Into<Box<dyn StyleSheet>>) -> Self { -        self.style = style.into(); +    pub fn style( +        mut self, +        style_sheet: impl Into<Box<dyn StyleSheet + 'a>>, +    ) -> Self { +        self.style_sheet = style_sheet.into();          self      } @@ -76,7 +79,7 @@ impl<Message> Checkbox<Message> {      }  } -impl<Message> Widget<Message> for Checkbox<Message> +impl<'a, Message> Widget<Message> for Checkbox<'a, Message>  where      Message: 'static,  { @@ -137,11 +140,11 @@ where      }  } -impl<'a, Message> From<Checkbox<Message>> for Element<'a, Message> +impl<'a, Message> From<Checkbox<'a, Message>> for Element<'a, Message>  where      Message: 'static,  { -    fn from(checkbox: Checkbox<Message>) -> Element<'a, Message> { +    fn from(checkbox: Checkbox<'a, Message>) -> Element<'a, Message> {          Element::new(checkbox)      }  } diff --git a/web/src/widget/container.rs b/web/src/widget/container.rs index 24aa7cef..8e345b9a 100644 --- a/web/src/widget/container.rs +++ b/web/src/widget/container.rs @@ -19,7 +19,7 @@ pub struct Container<'a, Message> {      max_height: u32,      horizontal_alignment: alignment::Horizontal,      vertical_alignment: alignment::Vertical, -    style_sheet: Box<dyn StyleSheet>, +    style_sheet: Box<dyn StyleSheet + 'a>,      content: Element<'a, Message>,  } @@ -89,7 +89,7 @@ impl<'a, Message> Container<'a, Message> {      }      /// Sets the style of the [`Container`]. -    pub fn style(mut self, style: impl Into<Box<dyn StyleSheet>>) -> Self { +    pub fn style(mut self, style: impl Into<Box<dyn StyleSheet + 'a>>) -> Self {          self.style_sheet = style.into();          self      } diff --git a/web/src/widget/progress_bar.rs b/web/src/widget/progress_bar.rs index 7d77616e..01f412f8 100644 --- a/web/src/widget/progress_bar.rs +++ b/web/src/widget/progress_bar.rs @@ -18,15 +18,15 @@ use std::ops::RangeInclusive;  ///  ///   #[allow(missing_debug_implementations)] -pub struct ProgressBar { +pub struct ProgressBar<'a> {      range: RangeInclusive<f32>,      value: f32,      width: Length,      height: Option<Length>, -    style: Box<dyn StyleSheet>, +    style: Box<dyn StyleSheet + 'a>,  } -impl ProgressBar { +impl<'a> ProgressBar<'a> {      /// Creates a new [`ProgressBar`].      ///      /// It expects: @@ -61,7 +61,7 @@ impl ProgressBar {      }  } -impl<Message> Widget<Message> for ProgressBar { +impl<'a, Message> Widget<Message> for ProgressBar<'a> {      fn node<'b>(          &self,          bump: &'b bumpalo::Bump, @@ -106,11 +106,11 @@ impl<Message> Widget<Message> for ProgressBar {      }  } -impl<'a, Message> From<ProgressBar> for Element<'a, Message> +impl<'a, Message> From<ProgressBar<'a>> for Element<'a, Message>  where      Message: 'static,  { -    fn from(container: ProgressBar) -> Element<'a, Message> { +    fn from(container: ProgressBar<'a>) -> Element<'a, Message> {          Element::new(container)      }  } diff --git a/web/src/widget/radio.rs b/web/src/widget/radio.rs index fbc88d29..03b2922b 100644 --- a/web/src/widget/radio.rs +++ b/web/src/widget/radio.rs @@ -31,17 +31,17 @@ use dodrio::bumpalo;  ///  ///   #[allow(missing_debug_implementations)] -pub struct Radio<Message> { +pub struct Radio<'a, Message> {      is_selected: bool,      on_click: Message,      label: String,      id: Option<String>,      name: Option<String>,      #[allow(dead_code)] -    style: Box<dyn StyleSheet>, +    style_sheet: Box<dyn StyleSheet + 'a>,  } -impl<Message> Radio<Message> { +impl<'a, Message> Radio<'a, Message> {      /// Creates a new [`Radio`] button.      ///      /// It expects: @@ -66,13 +66,16 @@ impl<Message> Radio<Message> {              label: label.into(),              id: None,              name: None, -            style: Default::default(), +            style_sheet: Default::default(),          }      }      /// Sets the style of the [`Radio`] button. -    pub fn style(mut self, style: impl Into<Box<dyn StyleSheet>>) -> Self { -        self.style = style.into(); +    pub fn style( +        mut self, +        style_sheet: impl Into<Box<dyn StyleSheet + 'a>>, +    ) -> Self { +        self.style_sheet = style_sheet.into();          self      } @@ -89,7 +92,7 @@ impl<Message> Radio<Message> {      }  } -impl<Message> Widget<Message> for Radio<Message> +impl<'a, Message> Widget<Message> for Radio<'a, Message>  where      Message: 'static + Clone,  { @@ -142,11 +145,11 @@ where      }  } -impl<'a, Message> From<Radio<Message>> for Element<'a, Message> +impl<'a, Message> From<Radio<'a, Message>> for Element<'a, Message>  where      Message: 'static + Clone,  { -    fn from(radio: Radio<Message>) -> Element<'a, Message> { +    fn from(radio: Radio<'a, Message>) -> Element<'a, Message> {          Element::new(radio)      }  } diff --git a/web/src/widget/scrollable.rs b/web/src/widget/scrollable.rs index 847bf5a0..22cb61be 100644 --- a/web/src/widget/scrollable.rs +++ b/web/src/widget/scrollable.rs @@ -14,7 +14,7 @@ pub struct Scrollable<'a, Message> {      max_height: u32,      content: Column<'a, Message>,      #[allow(dead_code)] -    style: Box<dyn StyleSheet>, +    style_sheet: Box<dyn StyleSheet + 'a>,  }  impl<'a, Message> Scrollable<'a, Message> { @@ -27,7 +27,7 @@ impl<'a, Message> Scrollable<'a, Message> {              height: Length::Shrink,              max_height: u32::MAX,              content: Column::new(), -            style: Default::default(), +            style_sheet: Default::default(),          }      } @@ -78,8 +78,11 @@ impl<'a, Message> Scrollable<'a, Message> {      }      /// Sets the style of the [`Scrollable`] . -    pub fn style(mut self, style: impl Into<Box<dyn StyleSheet>>) -> Self { -        self.style = style.into(); +    pub fn style( +        mut self, +        style_sheet: impl Into<Box<dyn StyleSheet + 'a>>, +    ) -> Self { +        self.style_sheet = style_sheet.into();          self      } diff --git a/web/src/widget/slider.rs b/web/src/widget/slider.rs index f457aa4c..8cbf5bd0 100644 --- a/web/src/widget/slider.rs +++ b/web/src/widget/slider.rs @@ -41,7 +41,7 @@ pub struct Slider<'a, T, Message> {      #[allow(dead_code)]      width: Length,      #[allow(dead_code)] -    style: Box<dyn StyleSheet>, +    style_sheet: Box<dyn StyleSheet + 'a>,  }  impl<'a, T, Message> Slider<'a, T, Message> @@ -85,7 +85,7 @@ where              step: T::from(1),              on_change: Rc::new(Box::new(on_change)),              width: Length::Fill, -            style: Default::default(), +            style_sheet: Default::default(),          }      } @@ -96,8 +96,11 @@ where      }      /// Sets the style of the [`Slider`]. -    pub fn style(mut self, style: impl Into<Box<dyn StyleSheet>>) -> Self { -        self.style = style.into(); +    pub fn style( +        mut self, +        style_sheet: impl Into<Box<dyn StyleSheet + 'a>>, +    ) -> Self { +        self.style_sheet = style_sheet.into();          self      } diff --git a/web/src/widget/text_input.rs b/web/src/widget/text_input.rs index e4877f2a..c5874485 100644 --- a/web/src/widget/text_input.rs +++ b/web/src/widget/text_input.rs @@ -39,7 +39,7 @@ pub struct TextInput<'a, Message> {      size: Option<u16>,      on_change: Rc<Box<dyn Fn(String) -> Message>>,      on_submit: Option<Message>, -    style_sheet: Box<dyn StyleSheet>, +    style_sheet: Box<dyn StyleSheet + 'a>,  }  impl<'a, Message> TextInput<'a, Message> { @@ -112,8 +112,11 @@ impl<'a, Message> TextInput<'a, Message> {      }      /// Sets the style of the [`TextInput`]. -    pub fn style(mut self, style: impl Into<Box<dyn StyleSheet>>) -> Self { -        self.style_sheet = style.into(); +    pub fn style( +        mut self, +        style_sheet: impl Into<Box<dyn StyleSheet + 'a>>, +    ) -> Self { +        self.style_sheet = style_sheet.into();          self      }  } | 
