commit
d0ebcdb936
2
.github/workflows/test.yml
vendored
2
.github/workflows/test.yml
vendored
@ -27,3 +27,5 @@ jobs:
|
||||
- uses: actions/checkout@master
|
||||
- name: Run checks
|
||||
run: cargo check --package iced --target wasm32-unknown-unknown
|
||||
- name: Check compilation of `tour` example
|
||||
run: cargo build --package tour --target wasm32-unknown-unknown
|
||||
|
@ -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(),
|
||||
}
|
||||
|
@ -49,7 +49,12 @@ impl<Message> Radio<Message> {
|
||||
/// receives the value of the radio and must produce a `Message`.
|
||||
///
|
||||
/// [`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
|
||||
V: Eq + Copy,
|
||||
F: 'static + Fn(V) -> Message,
|
||||
@ -57,7 +62,7 @@ impl<Message> Radio<Message> {
|
||||
Radio {
|
||||
is_selected: Some(value) == selected,
|
||||
on_click: f(value),
|
||||
label: String::from(label),
|
||||
label: label.into(),
|
||||
style: Default::default(),
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user