2022-11-13 15:26:25 +01:00
|
|
|
use {
|
2022-12-18 01:39:01 +01:00
|
|
|
crate::list::ListCursorMode
|
2022-11-13 15:26:25 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
//<<<<>>>><<>><><<>><<<*>>><<>><><<>><<<<>>>>
|
|
|
|
|
|
|
|
#[derive(Clone, Eq, PartialEq)]
|
|
|
|
pub struct TreeCursor {
|
|
|
|
pub leaf_mode: ListCursorMode,
|
|
|
|
pub tree_addr: Vec<isize>,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl TreeCursor {
|
|
|
|
pub fn home() -> Self {
|
|
|
|
TreeCursor {
|
|
|
|
leaf_mode: ListCursorMode::Insert,
|
|
|
|
tree_addr: vec![0]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn none() -> Self {
|
|
|
|
TreeCursor {
|
|
|
|
leaf_mode: ListCursorMode::Select,
|
|
|
|
tree_addr: vec![],
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Default for TreeCursor {
|
|
|
|
fn default() -> Self {
|
|
|
|
TreeCursor::none()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|