mirror of
https://github.com/FliegendeWurst/cursive.git
synced 2024-11-23 17:35:00 +00:00
Manually derive Clone for RadioGroup<T>
To avoid the `T: Clone` bound.
This commit is contained in:
parent
b3ada6be20
commit
b79ccf62da
@ -26,12 +26,19 @@ impl<T> SharedState<T> {
|
|||||||
/// A `RadioGroup` is used to create and manage [`RadioButton`]s.
|
/// A `RadioGroup` is used to create and manage [`RadioButton`]s.
|
||||||
///
|
///
|
||||||
/// A `RadioGroup` can be cloned; it will keep pointing to the same group.
|
/// A `RadioGroup` can be cloned; it will keep pointing to the same group.
|
||||||
#[derive(Clone)]
|
|
||||||
pub struct RadioGroup<T> {
|
pub struct RadioGroup<T> {
|
||||||
// Given to every child button
|
// Given to every child button
|
||||||
state: Rc<RefCell<SharedState<T>>>,
|
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> {
|
impl<T: 'static> Default for RadioGroup<T> {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self::new()
|
Self::new()
|
||||||
|
Loading…
Reference in New Issue
Block a user