Skip to content

Commit

Permalink
un-pub some TreeSelection implementation detail types
Browse files Browse the repository at this point in the history
  • Loading branch information
misson20000 committed Sep 11, 2023
1 parent d73cc8b commit 689056b
Showing 1 changed file with 19 additions and 18 deletions.
37 changes: 19 additions & 18 deletions src/model/selection/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,31 @@ use crate::model::document::structure;
use crate::model::versioned;
use crate::model::versioned::Versioned;

#[derive(Clone)]
pub struct Selection {
pub document: sync::Arc<document::Document>,
root: SparseNode,

version: versioned::Version<Selection>,
}

pub struct TreeIter<'a> {
selection: &'a Selection,
stack: Vec<(usize, SparseNodeOrAllGrandchildren<'a>, &'a sync::Arc<structure::Node>)>,
current_sparse: SparseNodeOrAllGrandchildren<'a>,
current_struct: &'a sync::Arc<structure::Node>,
child_index: Option<usize>,
}


#[derive(Clone, Debug)]
pub struct SparseNode {
struct SparseNode {
self_selected: bool,
children_selected: ChildrenMode,
}

#[derive(Clone, Debug)]
pub enum ChildrenMode {
enum ChildrenMode {
None,

Mixed(Vec<SparseNode>),
Expand All @@ -25,27 +42,11 @@ pub enum ChildrenMode {
AllGrandchildren,
}

#[derive(Clone)]
pub struct Selection {
pub document: sync::Arc<document::Document>,
pub root: SparseNode,

version: versioned::Version<Selection>,
}

enum SparseNodeOrAllGrandchildren<'a> {
Node(&'a SparseNode),
AllGrandchildren
}

pub struct TreeIter<'a> {
selection: &'a Selection,
stack: Vec<(usize, SparseNodeOrAllGrandchildren<'a>, &'a sync::Arc<structure::Node>)>,
current_sparse: SparseNodeOrAllGrandchildren<'a>,
current_struct: &'a sync::Arc<structure::Node>,
child_index: Option<usize>,
}

impl Selection {
pub fn new(document: sync::Arc<document::Document>) -> Self {
Selection {
Expand Down

0 comments on commit 689056b

Please sign in to comment.