pub struct Tree {
pub root_id: String,
pub nodes: GenericVector<GenericHashMap<String, Arc<Node>, RandomState, ArcK>, ArcK>,
pub parent_map: GenericHashMap<String, String, RandomState, ArcK>,
/* private fields */
}
Fields§
§root_id: String
§nodes: GenericVector<GenericHashMap<String, Arc<Node>, RandomState, ArcK>, ArcK>
§parent_map: GenericHashMap<String, String, RandomState, ArcK>
Implementations§
Source§impl Tree
impl Tree
pub fn get_shard_index(&self, id: &String) -> usize
pub fn get_shard_indices(&self, ids: &[&String]) -> Vec<usize>
pub fn get_shard_index_batch<'a>( &self, ids: &'a [&'a String], ) -> Vec<(usize, &'a String)>
pub fn clear_shard_cache()
pub fn contains_node(&self, id: &String) -> bool
pub fn get_node(&self, id: &String) -> Option<Arc<Node>>
pub fn get_parent_node(&self, id: &String) -> Option<Arc<Node>>
pub fn from(nodes: NodeEnum) -> Tree
pub fn new(root: Node) -> Tree
pub fn update_attr( &mut self, id: &String, new_values: GenericHashMap<String, Value, RandomState, ArcK>, ) -> Result<(), Error>
pub fn update_node(&mut self, node: Node) -> Result<(), Error>
pub fn add_at_index( &mut self, parent_id: &String, index: usize, node: &Node, ) -> Result<(), Error>
pub fn add_node( &mut self, parent_id: &String, nodes: &Vec<Node>, ) -> Result<(), Error>
pub fn node(&mut self, key: &str) -> NodeRef<'_>
pub fn mark(&mut self, key: &str) -> MarkRef<'_>
pub fn attrs(&mut self, key: &str) -> AttrsRef<'_>
pub fn children( &self, parent_id: &String, ) -> Option<GenericVector<String, ArcK>>
pub fn children_node( &self, parent_id: &String, ) -> Option<GenericVector<Arc<Node>, ArcK>>
pub fn all_children( &self, parent_id: &String, filter: Option<&dyn Fn(&Node) -> bool>, ) -> Option<NodeEnum>
pub fn children_count(&self, parent_id: &String) -> usize
pub fn remove_mark_by_name( &mut self, id: &String, mark_name: &str, ) -> Result<(), Error>
pub fn get_marks(&self, id: &String) -> Option<GenericVector<Mark, ArcK>>
pub fn remove_mark( &mut self, id: &String, mark_types: &[String], ) -> Result<(), Error>
pub fn add_mark(&mut self, id: &String, marks: &Vec<Mark>) -> Result<(), Error>
pub fn move_node( &mut self, source_parent_id: &String, target_parent_id: &String, node_id: &String, position: Option<usize>, ) -> Result<(), Error>
pub fn remove_node( &mut self, parent_id: &String, nodes: Vec<String>, ) -> Result<(), Error>
pub fn remove_node_by_id(&mut self, node_id: &String) -> Result<(), Error>
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Tree
impl<'de> Deserialize<'de> for Tree
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Tree, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Tree, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for Tree
impl Serialize for Tree
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for Tree
Auto Trait Implementations§
impl Freeze for Tree
impl RefUnwindSafe for Tree
impl Send for Tree
impl Sync for Tree
impl Unpin for Tree
impl UnwindSafe for Tree
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more