Checkbox label is now impl Into<String>

This commit is contained in:
Dmitry Kashitsyn 2020-04-04 13:21:45 +07:00
parent fd064ff990
commit 15f5b93a0d
No known key found for this signature in database
GPG Key ID: 7984C21B77FCB244

View File

@ -50,14 +50,14 @@ impl<Message, Renderer: self::Renderer + text::Renderer>
/// `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: Box::new(f),
label: String::from(label),
label: label.into(),
width: Length::Shrink,
size: <Renderer as self::Renderer>::DEFAULT_SIZE,
spacing: Renderer::DEFAULT_SPACING,