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>
impl<Weight, Wildness: IWildness, Children: IChildrenProvider<Arc<TokenCell<KeArcTreeNode<Weight, Weak<()>, Wildness, Children, DefaultToken>, DefaultToken>>>> KeArcTree<Weight, DefaultToken, Wildness, Children>
Sourcepub fn new() -> Result<(Self, DefaultToken), <DefaultToken as TokenTrait>::ConstructionError>
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>
impl<Weight, Wildness: IWildness, Children: IChildrenProvider<Arc<TokenCell<KeArcTreeNode<Weight, Weak<()>, Wildness, Children, Token>, Token>>>, Token: TokenTrait> KeArcTree<Weight, Token, Wildness, Children>
Sourcepub fn with_token(token: &Token) -> Self
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>
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>
Source§type Node = (&'a Arc<TokenCell<KeArcTreeNode<Weight, Weak<()>, Wildness, Children, Token>, Token>>, &'a Token)
type Node = (&'a Arc<TokenCell<KeArcTreeNode<Weight, Weak<()>, Wildness, Children, Token>, Token>>, &'a Token)
type NodeMut = (&'a Arc<TokenCell<KeArcTreeNode<Weight, Weak<()>, Wildness, Children, Token>, Token>>, &'a mut Token)
type TreeIterItem = <KeArcTree<Weight, Token, Wildness, Children> as ITokenKeyExprTree<'a, Weight, Token>>::Node
type TreeIter = TokenPacker<TreeIter<'a, Children, Arc<TokenCell<KeArcTreeNode<Weight, Weak<()>, Wildness, Children, Token>, Token>>, Weight>, &'a Token>
type TreeIterItemMut = Tokenized<&'a Arc<TokenCell<KeArcTreeNode<Weight, Weak<()>, Wildness, Children, Token>, Token>>, &'a mut Token>
type TreeIterMut = TokenPacker<TreeIter<'a, Children, Arc<TokenCell<KeArcTreeNode<Weight, Weak<()>, Wildness, Children, Token>, Token>>, Weight>, &'a mut Token>
type IntersectionItem = <KeArcTree<Weight, Token, Wildness, Children> as ITokenKeyExprTree<'a, Weight, Token>>::Node
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>
type IntersectionItemMut = <KeArcTree<Weight, Token, Wildness, Children> as ITokenKeyExprTree<'a, Weight, Token>>::TreeIterItemMut
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>
type InclusionItem = <KeArcTree<Weight, Token, Wildness, Children> as ITokenKeyExprTree<'a, Weight, Token>>::Node
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>
type InclusionItemMut = <KeArcTree<Weight, Token, Wildness, Children> as ITokenKeyExprTree<'a, Weight, Token>>::TreeIterItemMut
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>
type IncluderItem = <KeArcTree<Weight, Token, Wildness, Children> as ITokenKeyExprTree<'a, Weight, Token>>::Node
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>
type IncluderItemMut = <KeArcTree<Weight, Token, Wildness, Children> as ITokenKeyExprTree<'a, Weight, Token>>::TreeIterItemMut
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>
type PruneNode = KeArcTreeNode<Weight, Weak<()>, Wildness, Children, Token>
Source§fn node(&'a self, token: &'a Token, at: &keyexpr) -> Option<Self::Node>
fn node(&'a self, token: &'a Token, at: &keyexpr) -> Option<Self::Node>
key
if it exists, treating KEs as if they were completely verbatim keys. Read moreSource§fn node_mut(
&'a self,
token: &'a mut Token,
at: &keyexpr,
) -> Option<Self::NodeMut>
fn node_mut( &'a self, token: &'a mut Token, at: &keyexpr, ) -> Option<Self::NodeMut>
key
if it exists, treating KEs as if they were completely verbatim keys. Read moreSource§fn node_or_create(&'a self, token: &'a mut Token, at: &keyexpr) -> Self::NodeMut
fn node_or_create(&'a self, token: &'a mut Token, at: &keyexpr) -> Self::NodeMut
key
, creating it if necessary.Source§fn tree_iter(&'a self, token: &'a Token) -> Self::TreeIter
fn tree_iter(&'a self, token: &'a Token) -> Self::TreeIter
Source§fn tree_iter_mut(&'a self, token: &'a mut Token) -> Self::TreeIterMut
fn tree_iter_mut(&'a self, token: &'a mut Token) -> Self::TreeIterMut
Source§fn intersecting_nodes(
&'a self,
token: &'a Token,
key: &'a keyexpr,
) -> Self::Intersection
fn intersecting_nodes( &'a self, token: &'a Token, key: &'a keyexpr, ) -> Self::Intersection
key
. Read moreSource§fn intersecting_nodes_mut(
&'a self,
token: &'a mut Token,
key: &'a keyexpr,
) -> Self::IntersectionMut
fn intersecting_nodes_mut( &'a self, token: &'a mut Token, key: &'a keyexpr, ) -> Self::IntersectionMut
key
. Read moreSource§fn included_nodes(
&'a self,
token: &'a Token,
key: &'a keyexpr,
) -> Self::Inclusion
fn included_nodes( &'a self, token: &'a Token, key: &'a keyexpr, ) -> Self::Inclusion
key
. Read moreSource§fn included_nodes_mut(
&'a self,
token: &'a mut Token,
key: &'a keyexpr,
) -> Self::InclusionMut
fn included_nodes_mut( &'a self, token: &'a mut Token, key: &'a keyexpr, ) -> Self::InclusionMut
key
. Read moreSource§fn nodes_including(
&'a self,
token: &'a Token,
key: &'a keyexpr,
) -> Self::Includer
fn nodes_including( &'a self, token: &'a Token, key: &'a keyexpr, ) -> Self::Includer
key
. Read moreSource§fn nodes_including_mut(
&'a self,
token: &'a mut Token,
key: &'a keyexpr,
) -> Self::IncluderMut
fn nodes_including_mut( &'a self, token: &'a mut Token, key: &'a keyexpr, ) -> Self::IncluderMut
key
. Read morefn 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>
fn insert( &'a self, token: &'a mut Token, at: &keyexpr, weight: Weight, ) -> Option<Weight>
key
, returning the previous weight if it existed.Source§fn remove(&'a mut self, token: &'a mut Token, key: &keyexpr) -> Option<Weight>
fn remove(&'a mut self, token: &'a mut Token, key: &keyexpr) -> Option<Weight>
key
, but doesn’t actually destroy the node. Read moreSource§fn intersecting_keys(
&'a self,
token: &'a Token,
key: &'a keyexpr,
) -> FilterMap<Self::Intersection, fn(Self::IntersectionItem) -> Option<OwnedKeyExpr>> ⓘ
fn intersecting_keys( &'a self, token: &'a Token, key: &'a keyexpr, ) -> FilterMap<Self::Intersection, fn(Self::IntersectionItem) -> Option<OwnedKeyExpr>> ⓘ
key
Source§fn included_keys(
&'a self,
token: &'a Token,
key: &'a keyexpr,
) -> FilterMap<Self::Inclusion, fn(Self::InclusionItem) -> Option<OwnedKeyExpr>> ⓘ
fn included_keys( &'a self, token: &'a Token, key: &'a keyexpr, ) -> FilterMap<Self::Inclusion, fn(Self::InclusionItem) -> Option<OwnedKeyExpr>> ⓘ
key
Source§fn keys_including(
&'a self,
token: &'a Token,
key: &'a keyexpr,
) -> FilterMap<Self::Includer, fn(Self::IncluderItem) -> Option<OwnedKeyExpr>> ⓘ
fn keys_including( &'a self, token: &'a Token, key: &'a keyexpr, ) -> FilterMap<Self::Includer, fn(Self::IncluderItem) -> Option<OwnedKeyExpr>> ⓘ
key
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> 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
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>
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>
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