commit
d0ebcdb936
2
.github/workflows/test.yml
vendored
2
.github/workflows/test.yml
vendored
@ -27,3 +27,5 @@ jobs:
|
|||||||
- uses: actions/checkout@master
|
- uses: actions/checkout@master
|
||||||
- name: Run checks
|
- name: Run checks
|
||||||
run: cargo check --package iced --target wasm32-unknown-unknown
|
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`.
|
/// `Message`.
|
||||||
///
|
///
|
||||||
/// [`Checkbox`]: struct.Checkbox.html
|
/// [`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
|
where
|
||||||
F: 'static + Fn(bool) -> Message,
|
F: 'static + Fn(bool) -> Message,
|
||||||
{
|
{
|
||||||
Checkbox {
|
Checkbox {
|
||||||
is_checked,
|
is_checked,
|
||||||
on_toggle: Rc::new(f),
|
on_toggle: Rc::new(f),
|
||||||
label: String::from(label),
|
label: label.into(),
|
||||||
width: Length::Shrink,
|
width: Length::Shrink,
|
||||||
style: Default::default(),
|
style: Default::default(),
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,12 @@ impl<Message> Radio<Message> {
|
|||||||
/// 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,
|
||||||
@ -57,7 +62,7 @@ impl<Message> Radio<Message> {
|
|||||||
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: Default::default(),
|
style: Default::default(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user