Struct NodeRef

Source
pub struct NodeRef<'a> { /* private fields */ }

Implementations§

Source§

impl<'a> NodeRef<'a>

Source

pub fn new(tree: &'a mut Tree, key: String) -> NodeRef<'a>

Methods from Deref<Target = Tree>§

Source

pub fn get_shard_index(&self, id: &String) -> usize

Source

pub fn get_shard_indices(&self, ids: &[&String]) -> Vec<usize>

Source

pub fn get_shard_index_batch<'a>( &self, ids: &'a [&'a String], ) -> Vec<(usize, &'a String)>

Source

pub fn contains_node(&self, id: &String) -> bool

Source

pub fn get_node(&self, id: &String) -> Option<Arc<Node>>

Source

pub fn get_parent_node(&self, id: &String) -> Option<Arc<Node>>

Source

pub fn update_attr( &mut self, id: &String, new_values: GenericHashMap<String, Value, RandomState, ArcK>, ) -> Result<(), Error>

Source

pub fn update_node(&mut self, node: Node) -> Result<(), Error>

Source

pub fn add( &mut self, parent_id: &String, nodes: Vec<NodeEnum>, ) -> Result<(), Error>

向树中添加新的节点及其子节点

§参数
  • nodes - 要添加的节点枚举,包含节点本身及其子节点
§返回值
  • Result<(), PoolError> - 如果添加成功返回 Ok(()), 否则返回错误
§错误
  • PoolError::ParentNotFound - 如果父节点不存在
Source

pub fn add_at_index( &mut self, parent_id: &String, index: usize, node: &Node, ) -> Result<(), Error>

Source

pub fn add_node( &mut self, parent_id: &String, nodes: &Vec<Node>, ) -> Result<(), Error>

Source

pub fn node(&mut self, key: &str) -> NodeRef<'_>

Source

pub fn mark(&mut self, key: &str) -> MarkRef<'_>

Source

pub fn attrs(&mut self, key: &str) -> AttrsRef<'_>

Source

pub fn children( &self, parent_id: &String, ) -> Option<GenericVector<String, ArcK>>

Source

pub fn children_node( &self, parent_id: &String, ) -> Option<GenericVector<Arc<Node>, ArcK>>

Source

pub fn all_children( &self, parent_id: &String, filter: Option<&dyn Fn(&Node) -> bool>, ) -> Option<NodeEnum>

Source

pub fn children_count(&self, parent_id: &String) -> usize

Source

pub fn remove_mark_by_name( &mut self, id: &String, mark_name: &str, ) -> Result<(), Error>

Source

pub fn get_marks(&self, id: &String) -> Option<GenericVector<Mark, ArcK>>

Source

pub fn remove_mark( &mut self, id: &String, mark_types: &[String], ) -> Result<(), Error>

Source

pub fn add_mark(&mut self, id: &String, marks: &Vec<Mark>) -> Result<(), Error>

Source

pub fn move_node( &mut self, source_parent_id: &String, target_parent_id: &String, node_id: &String, position: Option<usize>, ) -> Result<(), Error>

Source

pub fn remove_node( &mut self, parent_id: &String, nodes: Vec<String>, ) -> Result<(), Error>

Source

pub fn remove_node_by_id(&mut self, node_id: &String) -> Result<(), Error>

Source

pub fn remove_node_by_index( &mut self, parent_id: &String, index: usize, ) -> Result<(), Error>

根据下标删除

Trait Implementations§

Source§

impl<'a> Add<(usize, Node)> for NodeRef<'a>

为 NodeRef 实现自定义的 + 运算符,用于在指定位置添加单个节点 当使用 + 运算符时,会将新节点添加到当前节点的子节点列表中的指定位置

Source§

type Output = Result<NodeRef<'a>, Error>

The resulting type after applying the + operator.
Source§

fn add(self, _: (usize, Node)) -> <NodeRef<'a> as Add<(usize, Node)>>::Output

Performs the + operation. Read more
Source§

impl<'a> Add<Node> for NodeRef<'a>

为 NodeRef 实现自定义的 + 运算符,用于添加单个节点 当使用 + 运算符时,会将新节点添加到当前节点的子节点列表中

Source§

type Output = Result<NodeRef<'a>, Error>

The resulting type after applying the + operator.
Source§

fn add(self, node: Node) -> <NodeRef<'a> as Add<Node>>::Output

Performs the + operation. Read more
Source§

impl<'a> Add<NodeEnum> for NodeRef<'a>

Source§

type Output = Result<NodeRef<'a>, Error>

The resulting type after applying the + operator.
Source§

fn add(self, nodes: NodeEnum) -> <NodeRef<'a> as Add<NodeEnum>>::Output

Performs the + operation. Read more
Source§

impl<'a> Add<Vec<Node>> for NodeRef<'a>

为 NodeRef 实现自定义的 + 运算符,用于添加多个节点 当使用 + 运算符时,会将多个新节点添加到当前节点的子节点列表中

Source§

type Output = Result<NodeRef<'a>, Error>

The resulting type after applying the + operator.
Source§

fn add(self, nodes: Vec<Node>) -> <NodeRef<'a> as Add<Vec<Node>>>::Output

Performs the + operation. Read more
Source§

impl<'a> BitAnd<String> for NodeRef<'a>

为 NodeRef 实现自定义的 & 运算符,用于过滤特定类型的子节点 当使用 & 运算符时,会保留指定类型的子节点,移除其他类型的子节点

Source§

type Output = Result<NodeRef<'a>, Error>

The resulting type after applying the & operator.
Source§

fn bitand(self, node_type: String) -> <NodeRef<'a> as BitAnd<String>>::Output

Performs the & operation. Read more
Source§

impl<'a> BitAnd<Vec<String>> for NodeRef<'a>

为 NodeRef 实现自定义的 & 运算符,用于保留多个指定类型的子节点 当使用 & 运算符时,会保留匹配任一指定类型的子节点,移除其他类型的子节点

Source§

type Output = Result<NodeRef<'a>, Error>

The resulting type after applying the & operator.
Source§

fn bitand( self, node_types: Vec<String>, ) -> <NodeRef<'a> as BitAnd<Vec<String>>>::Output

Performs the & operation. Read more
Source§

impl<'a> BitOr<String> for NodeRef<'a>

为 NodeRef 实现自定义的 | 运算符,用于合并另一个节点的所有子节点 当使用 | 运算符时,会将另一个节点的所有子节点复制到当前节点中

Source§

type Output = Result<NodeRef<'a>, Error>

The resulting type after applying the | operator.
Source§

fn bitor(self, other_node_id: String) -> <NodeRef<'a> as BitOr<String>>::Output

Performs the | operation. Read more
Source§

impl<'a> BitOr<Vec<Node>> for NodeRef<'a>

为 NodeRef 实现自定义的 | 运算符,用于直接合并节点列表 当使用 | 运算符时,会将提供的节点列表合并到当前节点中

Source§

type Output = Result<NodeRef<'a>, Error>

The resulting type after applying the | operator.
Source§

fn bitor(self, nodes: Vec<Node>) -> <NodeRef<'a> as BitOr<Vec<Node>>>::Output

Performs the | operation. Read more
Source§

impl<'a> BitOr<Vec<String>> for NodeRef<'a>

为 NodeRef 实现自定义的 | 运算符,用于合并多个节点的子节点 当使用 | 运算符时,会将多个节点的所有子节点复制到当前节点中

Source§

type Output = Result<NodeRef<'a>, Error>

The resulting type after applying the | operator.
Source§

fn bitor( self, other_node_ids: Vec<String>, ) -> <NodeRef<'a> as BitOr<Vec<String>>>::Output

Performs the | operation. Read more
Source§

impl<'a> Deref for NodeRef<'a>

Source§

type Target = Tree

The resulting type after dereferencing.
Source§

fn deref(&self) -> &<NodeRef<'a> as Deref>::Target

Dereferences the value.
Source§

impl<'a> DerefMut for NodeRef<'a>

Source§

fn deref_mut(&mut self) -> &mut <NodeRef<'a> as Deref>::Target

Mutably dereferences the value.
Source§

impl<'a> Mul<String> for NodeRef<'a>

为 NodeRef 实现自定义的 * 运算符,用于复制指定节点到当前位置 当使用 * 运算符时,会将指定节点复制到当前节点的子节点列表中

Source§

type Output = Result<NodeRef<'a>, Error>

The resulting type after applying the * operator.
Source§

fn mul(self, node_id: String) -> <NodeRef<'a> as Mul<String>>::Output

Performs the * operation. Read more
Source§

impl<'a> Mul<Vec<String>> for NodeRef<'a>

为 NodeRef 实现自定义的 * 运算符,用于批量复制多个指定节点 当使用 * 运算符时,会将指定的多个节点复制到当前节点的子节点列表中

Source§

type Output = Result<NodeRef<'a>, Error>

The resulting type after applying the * operator.
Source§

fn mul(self, node_ids: Vec<String>) -> <NodeRef<'a> as Mul<Vec<String>>>::Output

Performs the * operation. Read more
Source§

impl<'a> Mul<usize> for NodeRef<'a>

为 NodeRef 实现自定义的 * 运算符,用于复制当前节点N次 当使用 * 运算符时,会将当前节点复制指定次数并添加到父节点中

Source§

type Output = Result<NodeRef<'a>, Error>

The resulting type after applying the * operator.
Source§

fn mul(self, count: usize) -> <NodeRef<'a> as Mul<usize>>::Output

Performs the * operation. Read more
Source§

impl<'a> Shl<Node> for NodeRef<'a>

为 NodeRef 实现自定义的 << 运算符,用于在子节点列表开头插入单个节点 当使用 << 运算符时,会将新节点插入到当前节点的子节点列表的开头位置

Source§

type Output = Result<NodeRef<'a>, Error>

The resulting type after applying the << operator.
Source§

fn shl(self, node: Node) -> <NodeRef<'a> as Shl<Node>>::Output

Performs the << operation. Read more
Source§

impl<'a> Shl<Vec<Node>> for NodeRef<'a>

为 NodeRef 实现自定义的 << 运算符,用于在子节点列表开头插入多个节点 当使用 << 运算符时,会将多个新节点依次插入到当前节点的子节点列表的开头位置

Source§

type Output = Result<NodeRef<'a>, Error>

The resulting type after applying the << operator.
Source§

fn shl(self, nodes: Vec<Node>) -> <NodeRef<'a> as Shl<Vec<Node>>>::Output

Performs the << operation. Read more
Source§

impl<'a> Shl<usize> for NodeRef<'a>

为 NodeRef 实现自定义的 << 运算符,用于在指定数量的位置处插入节点 当使用 << 运算符时,会将当前节点向左移动指定位置数

Source§

type Output = Result<NodeRef<'a>, Error>

The resulting type after applying the << operator.
Source§

fn shl(self, positions: usize) -> <NodeRef<'a> as Shl<usize>>::Output

Performs the << operation. Read more
Source§

impl<'a> Shr<Node> for NodeRef<'a>

为 NodeRef 实现自定义的 >> 运算符,用于在子节点列表末尾添加单个节点 当使用 >> 运算符时,会将新节点添加到当前节点的子节点列表的末尾位置

Source§

type Output = Result<NodeRef<'a>, Error>

The resulting type after applying the >> operator.
Source§

fn shr(self, node: Node) -> <NodeRef<'a> as Shr<Node>>::Output

Performs the >> operation. Read more
Source§

impl<'a> Shr<Vec<Node>> for NodeRef<'a>

为 NodeRef 实现自定义的 >> 运算符,用于在子节点列表末尾添加多个节点 当使用 >> 运算符时,会将多个新节点添加到当前节点的子节点列表的末尾位置

Source§

type Output = Result<NodeRef<'a>, Error>

The resulting type after applying the >> operator.
Source§

fn shr(self, nodes: Vec<Node>) -> <NodeRef<'a> as Shr<Vec<Node>>>::Output

Performs the >> operation. Read more
Source§

impl<'a> Shr<usize> for NodeRef<'a>

为 NodeRef 实现自定义的 >> 运算符,用于将当前节点向右移动指定位置 当使用 >> 运算符时,会将当前节点在其父节点的子节点列表中向右移动指定位置数

Source§

type Output = Result<NodeRef<'a>, Error>

The resulting type after applying the >> operator.
Source§

fn shr(self, positions: usize) -> <NodeRef<'a> as Shr<usize>>::Output

Performs the >> operation. Read more
Source§

impl<'a> Sub<String> for NodeRef<'a>

为 NodeRef 实现自定义的 - 运算符,用于删除单个节点 当使用 - 运算符时,会从当前节点的子节点列表中移除指定的节点

Source§

type Output = Result<NodeRef<'a>, Error>

The resulting type after applying the - operator.
Source§

fn sub(self, node_id: String) -> <NodeRef<'a> as Sub<String>>::Output

Performs the - operation. Read more
Source§

impl<'a> Sub<Vec<String>> for NodeRef<'a>

为 NodeRef 实现自定义的 - 运算符,用于删除多个节点 当使用 - 运算符时,会从当前节点的子节点列表中移除指定的多个节点

Source§

type Output = Result<NodeRef<'a>, Error>

The resulting type after applying the - operator.
Source§

fn sub(self, node_ids: Vec<String>) -> <NodeRef<'a> as Sub<Vec<String>>>::Output

Performs the - operation. Read more
Source§

impl<'a> Sub<usize> for NodeRef<'a>

为 NodeRef 实现自定义的 - 运算符,用于删除单个节点 当使用 - 运算符时,会从当前节点的子节点列表中移除指定的节点

Source§

type Output = Result<NodeRef<'a>, Error>

The resulting type after applying the - operator.
Source§

fn sub(self, index: usize) -> <NodeRef<'a> as Sub<usize>>::Output

Performs the - operation. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for NodeRef<'a>

§

impl<'a> RefUnwindSafe for NodeRef<'a>

§

impl<'a> Send for NodeRef<'a>

§

impl<'a> Sync for NodeRef<'a>

§

impl<'a> Unpin for NodeRef<'a>

§

impl<'a> !UnwindSafe for NodeRef<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more