pub struct NodePool {
pub inner: Arc<NodePoolInner>,
}
Expand description
线程安全的节点池封装
使用 Arc
实现快速克隆,内部使用不可变数据结构保证线程安全
Fields§
§inner: Arc<NodePoolInner>
Implementations§
Source§impl NodePool
impl NodePool
Sourcepub fn contains_node(&self, id: &NodeId) -> bool
pub fn contains_node(&self, id: &NodeId) -> bool
检查节点是否存在
Sourcepub fn descendants(&self, parent_id: &NodeId) -> Vec<&Node>
pub fn descendants(&self, parent_id: &NodeId) -> Vec<&Node>
递归获取所有子节点(深度优先)
Sourcepub fn validate_hierarchy(&self) -> Result<(), PoolError>
pub fn validate_hierarchy(&self) -> Result<(), PoolError>
验证父子关系一致性
Sourcepub fn filter_nodes<P>(&self, predicate: P) -> Vec<&Arc<Node>>
pub fn filter_nodes<P>(&self, predicate: P) -> Vec<&Arc<Node>>
根据类型筛选节点
Trait Implementations§
Source§impl<'de> Deserialize<'de> for NodePool
impl<'de> Deserialize<'de> for NodePool
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Send for NodePool
impl StructuralPartialEq for NodePool
impl Sync for NodePool
Auto Trait Implementations§
impl Freeze for NodePool
impl RefUnwindSafe for NodePool
impl Unpin for NodePool
impl UnwindSafe for NodePool
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