summaryrefslogtreecommitdiffstats
path: root/web/src/widget/radio.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector0193@gmail.com>2021-11-07 15:15:33 +0700
committerLibravatar GitHub <noreply@github.com>2021-11-07 15:15:33 +0700
commiteafad00af2a9bae9f3ed8124e2a6f6e59ee5d253 (patch)
tree76413948c9c9723075189d51d4c2e02c0f8fdd23 /web/src/widget/radio.rs
parent61c747b53589d98f477fea95f85d2ea5349666d3 (diff)
parent07b5097bc92ced376d09115d787ff1d2ebe00836 (diff)
downloadiced-eafad00af2a9bae9f3ed8124e2a6f6e59ee5d253.tar.gz
iced-eafad00af2a9bae9f3ed8124e2a6f6e59ee5d253.tar.bz2
iced-eafad00af2a9bae9f3ed8124e2a6f6e59ee5d253.zip
Merge pull request #1110 from iced-rs/remove-renderer-traits
Reduce the surface of the `Renderer` APIs
Diffstat (limited to 'web/src/widget/radio.rs')
-rw-r--r--web/src/widget/radio.rs21
1 files changed, 12 insertions, 9 deletions
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;
///
/// ![Radio buttons drawn by Coffee's renderer](https://github.com/hecrj/coffee/blob/bda9818f823dfcb8a7ad0ff4940b4d4b387b5208/images/ui/radio.png?raw=true)
#[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)
}
}