KeArcTree

Struct KeArcTree 

Source
pub struct KeArcTree<Weight, Token: TokenTrait = DefaultToken, Wildness: IWildness = bool, Children: IChildrenProvider<Arc<TokenCell<KeArcTreeNode<Weight, Weak<()>, Wildness, Children, Token>, Token>>> = DefaultChildrenProvider> { /* private fields */ }
Expand description

A shared KeTree.

The tree and its nodes have shared ownership, while their mutability is managed through the Token.

Most of its methods are declared in the ITokenKeyExprTree trait.

Implementations§

Source§

impl<Weight, Wildness: IWildness, Children: IChildrenProvider<Arc<TokenCell<KeArcTreeNode<Weight, Weak<()>, Wildness, Children, DefaultToken>, DefaultToken>>>> KeArcTree<Weight, DefaultToken, Wildness, Children>

Source

pub fn new() -> Result<(Self, DefaultToken), <DefaultToken as TokenTrait>::ConstructionError>

Constructs the KeArcTree, returning it and its token, unless constructing the Token failed.

§Type inference papercut

Despite some of KeArcTree’s generic parameters having default values, those are only taken into account by the compiler when a type is named with some parameters omitted, and not when a type is inferred with the same parameters unconstrained.

The simplest way to resolve this is to eventually assign to tree part of the return value to a variable or field whose type is named KeArcTree<_> (the Weight parameter can generally be inferred).

Source§

impl<Weight, Wildness: IWildness, Children: IChildrenProvider<Arc<TokenCell<KeArcTreeNode<Weight, Weak<()>, Wildness, Children, Token>, Token>>>, Token: TokenTrait> KeArcTree<Weight, Token, Wildness, Children>

Source

pub fn with_token(token: &Token) -> Self

Constructs the KeArcTree with a specific token.

Trait Implementations§

Source§

impl<'a, Weight: 'a, Wildness: IWildness + 'a, Children: IChildrenProvider<Arc<TokenCell<KeArcTreeNode<Weight, Weak<()>, Wildness, Children, Token>, Token>>> + 'a, Token: TokenTrait + 'a> ITokenKeyExprTree<'a, Weight, Token> for KeArcTree<Weight, Token, Wildness, Children>
where Children::Assoc: IChildren<Arc<TokenCell<KeArcTreeNode<Weight, Weak<()>, Wildness, Children, Token>, Token>>>,

Source§

type Node = (&'a Arc<TokenCell<KeArcTreeNode<Weight, Weak<()>, Wildness, Children, Token>, Token>>, &'a Token)

An immutable guard to a node of the tree.
Source§

type NodeMut = (&'a Arc<TokenCell<KeArcTreeNode<Weight, Weak<()>, Wildness, Children, Token>, Token>>, &'a mut Token)

Source§

type TreeIterItem = <KeArcTree<Weight, Token, Wildness, Children> as ITokenKeyExprTree<'a, Weight, Token>>::Node

Source§

type TreeIter = TokenPacker<TreeIter<'a, Children, Arc<TokenCell<KeArcTreeNode<Weight, Weak<()>, Wildness, Children, Token>, Token>>, Weight>, &'a Token>

Source§

type TreeIterItemMut = Tokenized<&'a Arc<TokenCell<KeArcTreeNode<Weight, Weak<()>, Wildness, Children, Token>, Token>>, &'a mut Token>

Source§

type TreeIterMut = TokenPacker<TreeIter<'a, Children, Arc<TokenCell<KeArcTreeNode<Weight, Weak<()>, Wildness, Children, Token>, Token>>, Weight>, &'a mut Token>

Source§

type IntersectionItem = <KeArcTree<Weight, Token, Wildness, Children> as ITokenKeyExprTree<'a, Weight, Token>>::Node

Source§

type Intersection = IterOrOption<TokenPacker<Intersection<'a, Children, Arc<TokenCell<KeArcTreeNode<Weight, Weak<()>, Wildness, Children, Token>, Token>>, Weight>, &'a Token>, <KeArcTree<Weight, Token, Wildness, Children> as ITokenKeyExprTree<'a, Weight, Token>>::IntersectionItem>

Source§

type IntersectionItemMut = <KeArcTree<Weight, Token, Wildness, Children> as ITokenKeyExprTree<'a, Weight, Token>>::TreeIterItemMut

Source§

type IntersectionMut = IterOrOption<TokenPacker<Intersection<'a, Children, Arc<TokenCell<KeArcTreeNode<Weight, Weak<()>, Wildness, Children, Token>, Token>>, Weight>, &'a mut Token>, <KeArcTree<Weight, Token, Wildness, Children> as ITokenKeyExprTree<'a, Weight, Token>>::IntersectionItemMut>

Source§

type InclusionItem = <KeArcTree<Weight, Token, Wildness, Children> as ITokenKeyExprTree<'a, Weight, Token>>::Node

Source§

type Inclusion = IterOrOption<TokenPacker<Inclusion<'a, Children, Arc<TokenCell<KeArcTreeNode<Weight, Weak<()>, Wildness, Children, Token>, Token>>, Weight>, &'a Token>, <KeArcTree<Weight, Token, Wildness, Children> as ITokenKeyExprTree<'a, Weight, Token>>::InclusionItem>

Source§

type InclusionItemMut = <KeArcTree<Weight, Token, Wildness, Children> as ITokenKeyExprTree<'a, Weight, Token>>::TreeIterItemMut

Source§

type InclusionMut = IterOrOption<TokenPacker<Inclusion<'a, Children, Arc<TokenCell<KeArcTreeNode<Weight, Weak<()>, Wildness, Children, Token>, Token>>, Weight>, &'a mut Token>, <KeArcTree<Weight, Token, Wildness, Children> as ITokenKeyExprTree<'a, Weight, Token>>::InclusionItemMut>

Source§

type IncluderItem = <KeArcTree<Weight, Token, Wildness, Children> as ITokenKeyExprTree<'a, Weight, Token>>::Node

Source§

type Includer = IterOrOption<TokenPacker<Includer<'a, Children, Arc<TokenCell<KeArcTreeNode<Weight, Weak<()>, Wildness, Children, Token>, Token>>, Weight>, &'a Token>, <KeArcTree<Weight, Token, Wildness, Children> as ITokenKeyExprTree<'a, Weight, Token>>::IncluderItem>

Source§

type IncluderItemMut = <KeArcTree<Weight, Token, Wildness, Children> as ITokenKeyExprTree<'a, Weight, Token>>::TreeIterItemMut

Source§

type IncluderMut = IterOrOption<TokenPacker<Includer<'a, Children, Arc<TokenCell<KeArcTreeNode<Weight, Weak<()>, Wildness, Children, Token>, Token>>, Weight>, &'a mut Token>, <KeArcTree<Weight, Token, Wildness, Children> as ITokenKeyExprTree<'a, Weight, Token>>::IncluderItemMut>

Source§

type PruneNode = KeArcTreeNode<Weight, Weak<()>, Wildness, Children, Token>

Source§

fn node(&'a self, token: &'a Token, at: &keyexpr) -> Option<Self::Node>

Accesses the node at key if it exists, treating KEs as if they were completely verbatim keys. Read more
Source§

fn node_mut( &'a self, token: &'a mut Token, at: &keyexpr, ) -> Option<Self::NodeMut>

Mutably accesses the node at key if it exists, treating KEs as if they were completely verbatim keys. Read more
Source§

fn node_or_create(&'a self, token: &'a mut Token, at: &keyexpr) -> Self::NodeMut

Mutably accesses the node at key, creating it if necessary.
Source§

fn tree_iter(&'a self, token: &'a Token) -> Self::TreeIter

Iterates over the whole tree, including nodes with no weight.
Source§

fn tree_iter_mut(&'a self, token: &'a mut Token) -> Self::TreeIterMut

Iterates over the whole tree, including nodes with no weight.
Source§

fn intersecting_nodes( &'a self, token: &'a Token, key: &'a keyexpr, ) -> Self::Intersection

Iterates over all nodes of the tree whose KE intersects with the given key. Read more
Source§

fn intersecting_nodes_mut( &'a self, token: &'a mut Token, key: &'a keyexpr, ) -> Self::IntersectionMut

Iterates over all nodes of the tree whose KE intersects with the given key. Read more
Source§

fn included_nodes( &'a self, token: &'a Token, key: &'a keyexpr, ) -> Self::Inclusion

Iterates over all nodes of the tree whose KE is included by the given key. Read more
Source§

fn included_nodes_mut( &'a self, token: &'a mut Token, key: &'a keyexpr, ) -> Self::InclusionMut

Iterates over all nodes of the tree whose KE is included by the given key. Read more
Source§

fn nodes_including( &'a self, token: &'a Token, key: &'a keyexpr, ) -> Self::Includer

Iterates over all nodes of the tree whose KE includes the given key. Read more
Source§

fn nodes_including_mut( &'a self, token: &'a mut Token, key: &'a keyexpr, ) -> Self::IncluderMut

Iterates over all nodes of the tree whose KE includes the given key. Read more
Source§

fn prune_where<F: FnMut(&mut Self::PruneNode) -> bool>( &self, token: &mut Token, predicate: F, )

Source§

fn insert( &'a self, token: &'a mut Token, at: &keyexpr, weight: Weight, ) -> Option<Weight>

Inserts a weight at key, returning the previous weight if it existed.
Source§

fn remove(&'a mut self, token: &'a mut Token, key: &keyexpr) -> Option<Weight>

Clears the weight of the node at key, but doesn’t actually destroy the node. Read more
Source§

fn intersecting_keys( &'a self, token: &'a Token, key: &'a keyexpr, ) -> FilterMap<Self::Intersection, fn(Self::IntersectionItem) -> Option<OwnedKeyExpr>>
where Self::IntersectionItem: AsNode<Self::Node>, Self::Node: IKeyExprTreeNode<Weight>,

Returns an iterator over the KEs contained in the tree that intersect with key
Source§

fn included_keys( &'a self, token: &'a Token, key: &'a keyexpr, ) -> FilterMap<Self::Inclusion, fn(Self::InclusionItem) -> Option<OwnedKeyExpr>>
where Self::InclusionItem: AsNode<Self::Node>, Self::Node: IKeyExprTreeNode<Weight>,

Returns an iterator over the KEs contained in the tree that are included by key
Source§

fn keys_including( &'a self, token: &'a Token, key: &'a keyexpr, ) -> FilterMap<Self::Includer, fn(Self::IncluderItem) -> Option<OwnedKeyExpr>>
where Self::IncluderItem: AsNode<Self::Node>, Self::Node: IKeyExprTreeNode<Weight>,

Returns an iterator over the KEs contained in the tree that include key
Source§

fn prune(&self, token: &mut Token)

Auto Trait Implementations§

§

impl<Weight, Token = DefaultToken, Wildness = bool, Children = KeyedSetProvider> !Freeze for KeArcTree<Weight, Token, Wildness, Children>

§

impl<Weight, Token = DefaultToken, Wildness = bool, Children = KeyedSetProvider> !RefUnwindSafe for KeArcTree<Weight, Token, Wildness, Children>

§

impl<Weight, Token, Wildness, Children> Send for KeArcTree<Weight, Token, Wildness, Children>
where <Token as TokenTrait>::Identifier: Send, <Children as IChildrenProvider<Arc<TokenCell<KeArcTreeNode<Weight, Weak<()>, Wildness, Children, Token>, Token>>>>::Assoc: Send, Wildness: Send,

§

impl<Weight, Token, Wildness, Children> Sync for KeArcTree<Weight, Token, Wildness, Children>

§

impl<Weight, Token, Wildness, Children> Unpin for KeArcTree<Weight, Token, Wildness, Children>
where <Token as TokenTrait>::Identifier: Unpin, <Children as IChildrenProvider<Arc<TokenCell<KeArcTreeNode<Weight, Weak<()>, Wildness, Children, Token>, Token>>>>::Assoc: Unpin, Wildness: Unpin,

§

impl<Weight, Token, Wildness, Children> UnwindSafe for KeArcTree<Weight, Token, Wildness, Children>
where <Token as TokenTrait>::Identifier: UnwindSafe, <Children as IChildrenProvider<Arc<TokenCell<KeArcTreeNode<Weight, Weak<()>, Wildness, Children, Token>, Token>>>>::Assoc: UnwindSafe, Wildness: UnwindSafe,

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> AsNode<T> for T

Source§

fn as_node(&self) -> &T

Source§

impl<T> AsNodeMut<T> for T

Source§

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

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, 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, 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.