Radiobutton label is now impl Into<String>
This commit is contained in:
parent
15f5b93a0d
commit
1a9bfd9e73
@ -528,9 +528,10 @@ impl<'a> Step {
|
|||||||
.push(Language::all().iter().cloned().fold(
|
.push(Language::all().iter().cloned().fold(
|
||||||
Column::new().padding(10).spacing(20),
|
Column::new().padding(10).spacing(20),
|
||||||
|choices, language| {
|
|choices, language| {
|
||||||
|
let label: &str = language.into();
|
||||||
choices.push(Radio::new(
|
choices.push(Radio::new(
|
||||||
language,
|
language,
|
||||||
language.into(),
|
label,
|
||||||
selection,
|
selection,
|
||||||
StepMessage::LanguageSelected,
|
StepMessage::LanguageSelected,
|
||||||
))
|
))
|
||||||
|
@ -53,7 +53,12 @@ impl<Message, Renderer: self::Renderer> Radio<Message, Renderer> {
|
|||||||
/// receives the value of the radio and must produce a `Message`.
|
/// receives the value of the radio and must produce a `Message`.
|
||||||
///
|
///
|
||||||
/// [`Radio`]: struct.Radio.html
|
/// [`Radio`]: struct.Radio.html
|
||||||
pub fn new<F, V>(value: V, label: &str, selected: Option<V>, f: F) -> Self
|
pub fn new<F, V>(
|
||||||
|
value: V,
|
||||||
|
label: impl Into<String>,
|
||||||
|
selected: Option<V>,
|
||||||
|
f: F,
|
||||||
|
) -> Self
|
||||||
where
|
where
|
||||||
V: Eq + Copy,
|
V: Eq + Copy,
|
||||||
F: 'static + Fn(V) -> Message,
|
F: 'static + Fn(V) -> Message,
|
||||||
@ -61,7 +66,7 @@ impl<Message, Renderer: self::Renderer> Radio<Message, Renderer> {
|
|||||||
Radio {
|
Radio {
|
||||||
is_selected: Some(value) == selected,
|
is_selected: Some(value) == selected,
|
||||||
on_click: f(value),
|
on_click: f(value),
|
||||||
label: String::from(label),
|
label: label.into(),
|
||||||
style: Renderer::Style::default(),
|
style: Renderer::Style::default(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user