Manually derive Clone for RadioGroup<T>

To avoid the `T: Clone` bound.
This commit is contained in:
Alexandre Bury 2020-11-10 08:34:18 -08:00
parent b3ada6be20
commit b79ccf62da

View File

@ -26,12 +26,19 @@ impl<T> SharedState<T> {
/// A `RadioGroup` is used to create and manage [`RadioButton`]s.
///
/// A `RadioGroup` can be cloned; it will keep pointing to the same group.
#[derive(Clone)]
pub struct RadioGroup<T> {
// Given to every child button
state: Rc<RefCell<SharedState<T>>>,
}
impl<T> Clone for RadioGroup<T> {
fn clone(&self) -> Self {
Self {
state: Rc::clone(&self.state),
}
}
}
impl<T: 'static> Default for RadioGroup<T> {
fn default() -> Self {
Self::new()