Fix Checkbox and Radio API in iced_web

This commit is contained in:
Héctor Ramón Jiménez 2020-04-14 07:41:35 +02:00
parent 67fd107746
commit f7825fd936
3 changed files with 10 additions and 5 deletions

View file

@ -43,14 +43,14 @@ impl<Message> Checkbox<Message> {
/// `Message`.
///
/// [`Checkbox`]: struct.Checkbox.html
pub fn new<F>(is_checked: bool, label: &str, f: F) -> Self
pub fn new<F>(is_checked: bool, label: impl Into<String>, f: F) -> Self
where
F: 'static + Fn(bool) -> Message,
{
Checkbox {
is_checked,
on_toggle: Rc::new(f),
label: String::from(label),
label: label.into(),
width: Length::Shrink,
style: Default::default(),
}