mirror of
https://github.com/yewprint/yewprint
synced 2024-11-22 03:23:03 +00:00
Implement Debug and ImplicitClone for TreeData (#164)
This commit is contained in:
parent
48b2ef302a
commit
f5fdb429b6
1 changed files with 13 additions and 1 deletions
14
src/tree.rs
14
src/tree.rs
|
@ -11,12 +11,23 @@ use std::marker::PhantomData;
|
|||
use std::rc::Rc;
|
||||
use yew::prelude::*;
|
||||
|
||||
#[derive(Clone)]
|
||||
#[derive(Debug)]
|
||||
pub struct TreeData<T> {
|
||||
tree: Rc<RefCell<id_tree::Tree<NodeData<T>>>>,
|
||||
version: usize,
|
||||
}
|
||||
|
||||
impl<T> Clone for TreeData<T> {
|
||||
fn clone(&self) -> Self {
|
||||
Self {
|
||||
tree: self.tree.clone(),
|
||||
version: self.version,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> yew::html::ImplicitClone for TreeData<T> {}
|
||||
|
||||
impl<T> PartialEq for TreeData<T> {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
Rc::ptr_eq(&self.tree, &other.tree) && self.version == other.version
|
||||
|
@ -63,6 +74,7 @@ pub struct TreeProps<T: Clone + PartialEq> {
|
|||
pub class: Classes,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct NodeData<T> {
|
||||
pub disabled: bool,
|
||||
pub has_caret: bool,
|
||||
|
|
Loading…
Reference in a new issue