pub struct DependentWeave<K, T, M, S>{
pub metadata: M,
/* private fields */
}Expand description
A tree-based Weave where each Node depends on the contents of the previous Node.
For best performance, it is recommended that you use random node identifiers and the Hasher implementation from the nohash-hasher crate. If your node identifiers end with random data (such as ULIDs in their raw representation), use the hash_hasher crate instead.
Fields§
§metadata: MThe metadata associated with the weave.
Implementations§
Source§impl<K, T, M, S> DependentWeave<K, T, M, S>
impl<K, T, M, S> DependentWeave<K, T, M, S>
Sourcepub fn new(metadata: M) -> Self
pub fn new(metadata: M) -> Self
Creates a new, empty DependentWeave.
§Contracts
Post-condition: ret.nodes.is_empty()
Post-condition: ret.validate()
Sourcepub fn with_capacity(capacity: usize, metadata: M) -> Self
pub fn with_capacity(capacity: usize, metadata: M) -> Self
Creates a new, empty DependentWeave with at least the specified capacity.
This function over-allocates for worst-case memory usage rather than average-case.
§Contracts
Post-condition: ret.nodes.is_empty()
Post-condition: ret.validate()
Sourcepub fn capacity(&self) -> usize
pub fn capacity(&self) -> usize
Returns the worst-case number of nodes that the weave can hold without reallocating.
May be lower than self.len().
Sourcepub fn reserve(&mut self, additional: usize)
pub fn reserve(&mut self, additional: usize)
Reserves capacity for at least additional more nodes.
Sourcepub fn shrink_to_fit(&mut self)
pub fn shrink_to_fit(&mut self)
Shrinks the capacity of the weave as much as possible.
Trait Implementations§
Source§impl<K, T, M, S> ActionableWeave<K, DependentNode<K, T, S>, T, M, S> for DependentWeave<K, T, M, S>where
K: Hash + Copy + Eq + Ord,
T: IndependentContents + DiscreteContents,
S: BuildHasher + Default + Clone,
impl<K, T, M, S> ActionableWeave<K, DependentNode<K, T, S>, T, M, S> for DependentWeave<K, T, M, S>where
K: Hash + Copy + Eq + Ord,
T: IndependentContents + DiscreteContents,
S: BuildHasher + Default + Clone,
Source§fn apply(&mut self, action: WeaveAction<K, DependentNode<K, T, S>, T, M>)
fn apply(&mut self, action: WeaveAction<K, DependentNode<K, T, S>, T, M>)
Source§impl<K, T, M, S> ActiveSingularWeave<K, DependentNode<K, T, S>, T> for DependentWeave<K, T, M, S>
impl<K, T, M, S> ActiveSingularWeave<K, DependentNode<K, T, S>, T> for DependentWeave<K, T, M, S>
Source§impl<K, T, M, S> Archive for DependentWeave<K, T, M, S>where
K: Hash + Copy + Eq + Ord,
S: BuildHasher + Default + Clone,
HashMap<K, DependentNode<K, T, S>, S>: Archive,
IndexSet<K, S>: Archive,
Option<K>: Archive,
Skip: ArchiveWith<Scratchpad>,
M: Archive,
impl<K, T, M, S> Archive for DependentWeave<K, T, M, S>where
K: Hash + Copy + Eq + Ord,
S: BuildHasher + Default + Clone,
HashMap<K, DependentNode<K, T, S>, S>: Archive,
IndexSet<K, S>: Archive,
Option<K>: Archive,
Skip: ArchiveWith<Scratchpad>,
M: Archive,
Source§type Archived = ArchivedDependentWeave<K, T, M, S>
type Archived = ArchivedDependentWeave<K, T, M, S>
Source§type Resolver = DependentWeaveResolver<K, T, M, S>
type Resolver = DependentWeaveResolver<K, T, M, S>
Source§fn resolve(&self, resolver: Self::Resolver, out: Place<Self::Archived>)
fn resolve(&self, resolver: Self::Resolver, out: Place<Self::Archived>)
Source§const COPY_OPTIMIZATION: CopyOptimization<Self> = _
const COPY_OPTIMIZATION: CopyOptimization<Self> = _
serialize. Read moreSource§impl<K, T, M, S> BookmarkableWeave<K, DependentNode<K, T, S>, T> for DependentWeave<K, T, M, S>
impl<K, T, M, S> BookmarkableWeave<K, DependentNode<K, T, S>, T> for DependentWeave<K, T, M, S>
Source§fn set_bookmarked(&mut self, id: &K, value: bool) -> bool
fn set_bookmarked(&mut self, id: &K, value: bool) -> bool
§Contracts
Post-condition: ! ret || value == self.bookmarked.contains(id)
Post-condition: ret || old(self.bookmarked.clone()) == self.bookmarked
Post-condition: ret == self.nodes.contains_key(id)
Post-condition: old(self.nodes.keys().copied().collect::<HashSet<_>>()) == self.nodes.keys().copied().collect ::< HashSet < _ >> ()
Post-condition: old(self.roots.clone()) == self.roots
Post-condition: old(self.active) == self.active
Invariant: self.validate()
Source§fn bookmarks(&self) -> &Self::Bookmarks
fn bookmarks(&self) -> &Self::Bookmarks
Source§fn contains_bookmark(&self, id: &K) -> bool
fn contains_bookmark(&self, id: &K) -> bool
true if the Weave contains a bookmarked node with the specified identifier.Source§impl<K, T: Clone, M: Clone, S> Clone for DependentWeave<K, T, M, S>
impl<K, T: Clone, M: Clone, S> Clone for DependentWeave<K, T, M, S>
Source§fn clone(&self) -> DependentWeave<K, T, M, S>
fn clone(&self) -> DependentWeave<K, T, M, S>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<K, T, M, S> Default for DependentWeave<K, T, M, S>
impl<K, T, M, S> Default for DependentWeave<K, T, M, S>
Source§impl<__D: Fallible + ?Sized, K, T, M, S> Deserialize<DependentWeave<K, T, M, S>, __D> for Archived<DependentWeave<K, T, M, S>>where
K: Hash + Copy + Eq + Ord,
S: BuildHasher + Default + Clone,
HashMap<K, DependentNode<K, T, S>, S>: Archive,
<HashMap<K, DependentNode<K, T, S>, S> as Archive>::Archived: Deserialize<HashMap<K, DependentNode<K, T, S>, S>, __D>,
IndexSet<K, S>: Archive,
<IndexSet<K, S> as Archive>::Archived: Deserialize<IndexSet<K, S>, __D>,
Option<K>: Archive,
<Option<K> as Archive>::Archived: Deserialize<Option<K>, __D>,
Skip: ArchiveWith<Scratchpad> + DeserializeWith<<Skip as ArchiveWith<Scratchpad>>::Archived, Scratchpad, __D>,
M: Archive,
<M as Archive>::Archived: Deserialize<M, __D>,
impl<__D: Fallible + ?Sized, K, T, M, S> Deserialize<DependentWeave<K, T, M, S>, __D> for Archived<DependentWeave<K, T, M, S>>where
K: Hash + Copy + Eq + Ord,
S: BuildHasher + Default + Clone,
HashMap<K, DependentNode<K, T, S>, S>: Archive,
<HashMap<K, DependentNode<K, T, S>, S> as Archive>::Archived: Deserialize<HashMap<K, DependentNode<K, T, S>, S>, __D>,
IndexSet<K, S>: Archive,
<IndexSet<K, S> as Archive>::Archived: Deserialize<IndexSet<K, S>, __D>,
Option<K>: Archive,
<Option<K> as Archive>::Archived: Deserialize<Option<K>, __D>,
Skip: ArchiveWith<Scratchpad> + DeserializeWith<<Skip as ArchiveWith<Scratchpad>>::Archived, Scratchpad, __D>,
M: Archive,
<M as Archive>::Archived: Deserialize<M, __D>,
Source§fn deserialize(
&self,
deserializer: &mut __D,
) -> Result<DependentWeave<K, T, M, S>, <__D as Fallible>::Error>
fn deserialize( &self, deserializer: &mut __D, ) -> Result<DependentWeave<K, T, M, S>, <__D as Fallible>::Error>
Source§impl<K, T, M, S> DiscreteWeave<K, DependentNode<K, T, S>, T> for DependentWeave<K, T, M, S>
impl<K, T, M, S> DiscreteWeave<K, DependentNode<K, T, S>, T> for DependentWeave<K, T, M, S>
Source§fn split(&mut self, id: &K, at: usize, new_id: K) -> bool
fn split(&mut self, id: &K, at: usize, new_id: K) -> bool
§Contracts
Post-condition: ! ret || old(self.nodes.len()) + 1 == self.nodes.len()
Post-condition: ! ret || self.nodes.contains_key(id)
Post-condition: ! ret || self.nodes.contains_key(&new_id)
Post-condition: ! ret || old(!self.nodes.contains_key(&new_id))
Post-condition: ! ret || self.nodes [id].to.contains(&new_id) && self.nodes [id].to.len() == 1
Post-condition: ! ret || self.nodes [&new_id].from == Some(*id)
Post-condition: ! ret || old(self.nodes.get(id).map(|n| n.to.clone())).unwrap() == self.nodes [&new_id].to
Post-condition: ret || old(self.nodes.keys().copied().collect::<HashSet<_>>()) == self.nodes.keys().copied().collect ::< HashSet < _ >> ()
Post-condition: old(self.roots.clone()) == self.roots
Post-condition: old(self.active) == self.active
Post-condition: old(self.bookmarked.clone()) == self.bookmarked
Invariant: self.validate()
Source§fn merge_with_parent(&mut self, id: &K) -> Option<K>
fn merge_with_parent(&mut self, id: &K) -> Option<K>
§Contracts
Post-condition: ret.is_none() || old(self.nodes.len()) - 1 == self.nodes.len()
Post-condition: ret.is_none() || ! self.nodes.contains_key(id)
Post-condition: ret.is_none() || old(self.nodes.contains_key(id))
Post-condition: ret.is_none() || ! old(self.contains_active(id)) || old(self.contains_active(id)) && self.contains_active(&ret.unwrap())
Post-condition: ret.is_none() || old(self.contains_active(id)) || old(self.nodes.get(id).and_then(|n| n.from).and_then(|p| self.nodes.get(&p)).map(|p| p.active)).unwrap() == self.nodes [&ret.unwrap()].active
Post-condition: ret.is_none() || old(self.nodes.get(id).and_then(|n| n.from).and_then(|p| self.nodes.get(&p)).map(|p| p.from)).unwrap() == self.nodes [&ret.unwrap()].from
Post-condition: ret.is_none() || old(self.nodes.get(id).map(|node| node.to.clone())).unwrap() == self.nodes [&ret.unwrap()].to
Post-condition: ret.is_none() || ret.unwrap() == old(self.nodes.get(id).and_then(|node| node.from)).unwrap()
Post-condition: ret.is_some() || old(self.nodes.keys().copied().collect::<HashSet<_>>()) == self.nodes.keys().copied().collect ::< HashSet < _ >> ()
Post-condition: ret.is_some() || old(self.active) == self.active
Post-condition: ret.is_some() || old(self.bookmarked.clone()) == self.bookmarked
Post-condition: old(self.roots.clone()) == self.roots
Invariant: self.validate()
impl<K, T, M, S> Eq for DependentWeave<K, T, M, S>
Source§impl<K, T, M, S> From<DependentWeave<K, T, M, S>> for IndependentWeave<K, T, M, S>
impl<K, T, M, S> From<DependentWeave<K, T, M, S>> for IndependentWeave<K, T, M, S>
Source§fn from(value: DependentWeave<K, T, M, S>) -> Self
fn from(value: DependentWeave<K, T, M, S>) -> Self
Source§impl<K, T, M, S> Layouter<DependentWeave<K, T, M, S>, K, DependentNode<K, T, S>, T, Vec2, ArrayVec<[Vec2; 6]>> for DependentLayouter<K>
impl<K, T, M, S> Layouter<DependentWeave<K, T, M, S>, K, DependentNode<K, T, S>, T, Vec2, ArrayVec<[Vec2; 6]>> for DependentLayouter<K>
Source§impl<K, T, M, S> MetadataWeave<K, DependentNode<K, T, S>, T, M> for DependentWeave<K, T, M, S>
impl<K, T, M, S> MetadataWeave<K, DependentNode<K, T, S>, T, M> for DependentWeave<K, T, M, S>
Source§fn metadata_mut<O>(&mut self, callback: impl FnOnce(&mut M) -> O) -> O
fn metadata_mut<O>(&mut self, callback: impl FnOnce(&mut M) -> O) -> O
§Contracts
Post-condition: old(self.nodes.keys().copied().collect::<HashSet<_>>()) == self.nodes.keys().copied().collect ::< HashSet < _ >> ()
Post-condition: old(self.roots.clone()) == self.roots
Post-condition: old(self.active) == self.active
Post-condition: old(self.bookmarked.clone()) == self.bookmarked
Invariant: self.validate()
Source§impl<K, T, M, S> PartialEq for DependentWeave<K, T, M, S>
impl<K, T, M, S> PartialEq for DependentWeave<K, T, M, S>
Source§impl<K, T, M, S> SemiIndependentWeave<K, DependentNode<K, T, S>, T> for DependentWeave<K, T, M, S>
impl<K, T, M, S> SemiIndependentWeave<K, DependentNode<K, T, S>, T> for DependentWeave<K, T, M, S>
Source§fn get_contents_mut<O>(
&mut self,
id: &K,
callback: impl FnOnce(&mut T) -> O,
) -> Option<O>
fn get_contents_mut<O>( &mut self, id: &K, callback: impl FnOnce(&mut T) -> O, ) -> Option<O>
§Contracts
Post-condition: ret.is_some() == old(self.nodes.contains_key(id))
Post-condition: old(self.nodes.keys().copied().collect::<HashSet<_>>()) == self.nodes.keys().copied().collect ::< HashSet < _ >> ()
Post-condition: old(self.roots.clone()) == self.roots
Post-condition: old(self.active) == self.active
Post-condition: old(self.bookmarked.clone()) == self.bookmarked
Invariant: self.validate()
Source§impl<__S: Fallible + ?Sized, K, T, M, S> Serialize<__S> for DependentWeave<K, T, M, S>where
K: Hash + Copy + Eq + Ord,
S: BuildHasher + Default + Clone,
HashMap<K, DependentNode<K, T, S>, S>: Serialize<__S>,
IndexSet<K, S>: Serialize<__S>,
Option<K>: Serialize<__S>,
Skip: SerializeWith<Scratchpad, __S>,
M: Serialize<__S>,
impl<__S: Fallible + ?Sized, K, T, M, S> Serialize<__S> for DependentWeave<K, T, M, S>where
K: Hash + Copy + Eq + Ord,
S: BuildHasher + Default + Clone,
HashMap<K, DependentNode<K, T, S>, S>: Serialize<__S>,
IndexSet<K, S>: Serialize<__S>,
Option<K>: Serialize<__S>,
Skip: SerializeWith<Scratchpad, __S>,
M: Serialize<__S>,
Source§impl<K, T, M, S> SortableBookmarkableWeave<K, DependentNode<K, T, S>, T> for DependentWeave<K, T, M, S>
impl<K, T, M, S> SortableBookmarkableWeave<K, DependentNode<K, T, S>, T> for DependentWeave<K, T, M, S>
Source§fn sort_bookmarks_by(
&mut self,
cmp: impl FnMut(&DependentNode<K, T, S>, &DependentNode<K, T, S>) -> Ordering,
)
fn sort_bookmarks_by( &mut self, cmp: impl FnMut(&DependentNode<K, T, S>, &DependentNode<K, T, S>) -> Ordering, )
§Contracts
Post-condition: old(self.nodes.keys().copied().collect::<HashSet<_>>()) == self.nodes.keys().copied().collect ::< HashSet < _ >> ()
Post-condition: old(self.roots.clone()) == self.roots
Post-condition: old(self.active) == self.active
Post-condition: old(self.bookmarked.clone()) == self.bookmarked
Invariant: self.validate()
Source§fn sort_bookmarks_by_id(&mut self, cmp: impl FnMut(&K, &K) -> Ordering)
fn sort_bookmarks_by_id(&mut self, cmp: impl FnMut(&K, &K) -> Ordering)
§Contracts
Post-condition: old(self.nodes.keys().copied().collect::<HashSet<_>>()) == self.nodes.keys().copied().collect ::< HashSet < _ >> ()
Post-condition: old(self.roots.clone()) == self.roots
Post-condition: old(self.active) == self.active
Post-condition: old(self.bookmarked.clone()) == self.bookmarked
Invariant: self.validate()
Source§impl<K, T, M, S> SortableWeave<K, DependentNode<K, T, S>, T> for DependentWeave<K, T, M, S>
impl<K, T, M, S> SortableWeave<K, DependentNode<K, T, S>, T> for DependentWeave<K, T, M, S>
Source§fn sort_children_by(
&mut self,
id: &K,
cmp: impl FnMut(&DependentNode<K, T, S>, &DependentNode<K, T, S>) -> Ordering,
) -> bool
fn sort_children_by( &mut self, id: &K, cmp: impl FnMut(&DependentNode<K, T, S>, &DependentNode<K, T, S>) -> Ordering, ) -> bool
§Contracts
Post-condition: ret == self.nodes.contains_key(id)
Post-condition: old(self.nodes.get(id).map(|n| n.to.clone())) == self.nodes.get(id).map(|n| n.to.clone())
Post-condition: old(self.nodes.keys().copied().collect::<HashSet<_>>()) == self.nodes.keys().copied().collect ::< HashSet < _ >> ()
Post-condition: old(self.roots.clone()) == self.roots
Post-condition: old(self.active) == self.active
Post-condition: old(self.bookmarked.clone()) == self.bookmarked
Invariant: self.validate()
Source§fn sort_children_by_id(
&mut self,
id: &K,
cmp: impl FnMut(&K, &K) -> Ordering,
) -> bool
fn sort_children_by_id( &mut self, id: &K, cmp: impl FnMut(&K, &K) -> Ordering, ) -> bool
§Contracts
Post-condition: ret == self.nodes.contains_key(id)
Post-condition: old(self.nodes.get(id).map(|n| n.to.clone())) == self.nodes.get(id).map(|n| n.to.clone())
Post-condition: old(self.nodes.keys().copied().collect::<HashSet<_>>()) == self.nodes.keys().copied().collect ::< HashSet < _ >> ()
Post-condition: old(self.roots.clone()) == self.roots
Post-condition: old(self.active) == self.active
Post-condition: old(self.bookmarked.clone()) == self.bookmarked
Invariant: self.validate()
Source§fn sort_roots_by(
&mut self,
cmp: impl FnMut(&DependentNode<K, T, S>, &DependentNode<K, T, S>) -> Ordering,
)
fn sort_roots_by( &mut self, cmp: impl FnMut(&DependentNode<K, T, S>, &DependentNode<K, T, S>) -> Ordering, )
§Contracts
Post-condition: old(self.nodes.keys().copied().collect::<HashSet<_>>()) == self.nodes.keys().copied().collect ::< HashSet < _ >> ()
Post-condition: old(self.roots.clone()) == self.roots
Post-condition: old(self.active) == self.active
Post-condition: old(self.bookmarked.clone()) == self.bookmarked
Invariant: self.validate()
Source§fn sort_roots_by_id(&mut self, cmp: impl FnMut(&K, &K) -> Ordering)
fn sort_roots_by_id(&mut self, cmp: impl FnMut(&K, &K) -> Ordering)
§Contracts
Post-condition: old(self.nodes.keys().copied().collect::<HashSet<_>>()) == self.nodes.keys().copied().collect ::< HashSet < _ >> ()
Post-condition: old(self.roots.clone()) == self.roots
Post-condition: old(self.active) == self.active
Post-condition: old(self.bookmarked.clone()) == self.bookmarked
Invariant: self.validate()
Source§impl<K, T, M, S> TryFrom<IndependentWeave<K, T, M, S>> for DependentWeave<K, T, M, S>
impl<K, T, M, S> TryFrom<IndependentWeave<K, T, M, S>> for DependentWeave<K, T, M, S>
Source§type Error = IndependentWeave<K, T, M, S>
type Error = IndependentWeave<K, T, M, S>
Source§impl<K, T, M, S> Weave<K, DependentNode<K, T, S>, T> for DependentWeave<K, T, M, S>
impl<K, T, M, S> Weave<K, DependentNode<K, T, S>, T> for DependentWeave<K, T, M, S>
Source§fn get_ordered_identifiers(&mut self, output: &mut Vec<K>)
fn get_ordered_identifiers(&mut self, output: &mut Vec<K>)
§Contracts
Post-condition: output.len() == self.nodes.len()
Post-condition: valid_topological_sort(&self.nodes, output)
Post-condition: old(self.nodes.keys().copied().collect::<HashSet<_>>()) == self.nodes.keys().copied().collect ::< HashSet < _ >> ()
Post-condition: old(self.roots.clone()) == self.roots
Post-condition: old(self.active) == self.active
Post-condition: old(self.bookmarked.clone()) == self.bookmarked
Invariant: self.validate()
Source§fn get_ordered_identifiers_from(&mut self, id: &K, output: &mut Vec<K>)
fn get_ordered_identifiers_from(&mut self, id: &K, output: &mut Vec<K>)
§Contracts
Post-condition: lacks_duplicates(output)
Post-condition: ! self.nodes.contains_key(id) || output.first() == Some(id)
Post-condition: self.nodes.contains_key(id) || output.is_empty()
Post-condition: old(self.nodes.keys().copied().collect::<HashSet<_>>()) == self.nodes.keys().copied().collect ::< HashSet < _ >> ()
Post-condition: old(self.roots.clone()) == self.roots
Post-condition: old(self.active) == self.active
Post-condition: old(self.bookmarked.clone()) == self.bookmarked
Invariant: self.validate()
Source§fn get_active_path(&mut self, output: &mut Vec<K>)
fn get_active_path(&mut self, output: &mut Vec<K>)
§Contracts
Post-condition: self.active == output.first().copied()
Post-condition: lacks_duplicates(output)
Post-condition: valid_path(&self.nodes, output)
Post-condition: old(self.nodes.keys().copied().collect::<HashSet<_>>()) == self.nodes.keys().copied().collect ::< HashSet < _ >> ()
Post-condition: old(self.roots.clone()) == self.roots
Post-condition: old(self.active) == self.active
Post-condition: old(self.bookmarked.clone()) == self.bookmarked
Invariant: self.validate()
Source§fn get_path_from(&mut self, id: &K, output: &mut Vec<K>)
fn get_path_from(&mut self, id: &K, output: &mut Vec<K>)
§Contracts
Post-condition: ! self.nodes.contains_key(id) || output.first() == Some(id)
Post-condition: self.nodes.contains_key(id) || output.is_empty()
Post-condition: lacks_duplicates(output)
Post-condition: valid_path(&self.nodes, output)
Post-condition: old(self.nodes.keys().copied().collect::<HashSet<_>>()) == self.nodes.keys().copied().collect ::< HashSet < _ >> ()
Post-condition: old(self.roots.clone()) == self.roots
Post-condition: old(self.active) == self.active
Post-condition: old(self.bookmarked.clone()) == self.bookmarked
Invariant: self.validate()
Source§fn insert(&mut self, node: DependentNode<K, T, S>) -> bool
fn insert(&mut self, node: DependentNode<K, T, S>) -> bool
§Contracts
Post-condition: ! ret || old(self.nodes.len()) + 1 == self.nodes.len()
Post-condition: ! ret || old(!self.nodes.contains_key(&node.id))
Post-condition: ! ret || self.nodes.contains_key(&old(node.id))
Post-condition: ! ret || old(node.active) == (self.active == Some(old(node.id)))
Post-condition: ! ret || old(node.bookmarked) == self.bookmarked.contains(&old(node.id))
Post-condition: ! ret || old(node.from.is_some()) || self.roots.contains(&old(node.id))
Post-condition: ! ret || old(node.from.is_none()) || old(self.roots.clone()) == self.roots
Post-condition: ret || old(self.nodes.keys().copied().collect::<HashSet<_>>()) == self.nodes.keys().copied().collect ::< HashSet < _ >> ()
Post-condition: ret || old(self.roots.clone()) == self.roots
Post-condition: ret || old(self.active) == self.active
Post-condition: ret || old(self.bookmarked.clone()) == self.bookmarked
Invariant: self.validate()
Source§fn set_active(&mut self, id: &K, value: bool) -> bool
fn set_active(&mut self, id: &K, value: bool) -> bool
§Contracts
Post-condition: ! ret || value == self.contains_active(id)
Post-condition: ret || old(self.active) == self.active
Post-condition: ret == self.nodes.contains_key(id)
Post-condition: old(self.nodes.keys().copied().collect::<HashSet<_>>()) == self.nodes.keys().copied().collect ::< HashSet < _ >> ()
Post-condition: old(self.roots.clone()) == self.roots
Post-condition: old(self.bookmarked.clone()) == self.bookmarked
Invariant: self.validate()
Source§fn remove(&mut self, id: &K) -> Option<DependentNode<K, T, S>>
fn remove(&mut self, id: &K) -> Option<DependentNode<K, T, S>>
§Contracts
Post-condition: ! self.nodes.contains_key(id)
Post-condition: ret.is_some() == old(self.nodes.contains_key(id))
Post-condition: ret.as_ref().is_none_or(|node| &node.id == id)
Post-condition: ret.is_none() || old(self.nodes.len()) > self.nodes.len()
Post-condition: ret.is_none() || old(self.bookmarked.len()) >= self.bookmarked.len()
Post-condition: ret.is_some() || old(self.nodes.keys().copied().collect::<HashSet<_>>()) == self.nodes.keys().copied().collect ::< HashSet < _ >> ()
Post-condition: ret.is_some() || old(self.roots.clone()) == self.roots
Post-condition: ret.is_some() || old(self.active) == self.active
Post-condition: ret.is_some() || old(self.bookmarked.clone()) == self.bookmarked
Invariant: self.validate()
Source§fn remove_tracked(
&mut self,
id: &K,
on_removal: impl FnMut(DependentNode<K, T, S>),
) -> bool
fn remove_tracked( &mut self, id: &K, on_removal: impl FnMut(DependentNode<K, T, S>), ) -> bool
§Contracts
Post-condition: ! self.nodes.contains_key(id)
Post-condition: ret == old(self.nodes.contains_key(id))
Post-condition: ! ret || old(self.nodes.len()) > self.nodes.len()
Post-condition: ! ret || old(self.bookmarked.len()) >= self.bookmarked.len()
Post-condition: ret || old(self.nodes.keys().copied().collect::<HashSet<_>>()) == self.nodes.keys().copied().collect ::< HashSet < _ >> ()
Post-condition: ret || old(self.roots.clone()) == self.roots
Post-condition: ret || old(self.active) == self.active
Post-condition: ret || old(self.bookmarked.clone()) == self.bookmarked
Invariant: self.validate()
Source§type Nodes = HashMap<K, DependentNode<K, T, S>, S>
type Nodes = HashMap<K, DependentNode<K, T, S>, S>
Source§type Roots = IndexSet<K, S>
type Roots = IndexSet<K, S>
Source§fn roots(&self) -> &Self::Roots
fn roots(&self) -> &Self::Roots
Source§fn contains(&self, id: &K) -> bool
fn contains(&self, id: &K) -> bool
true if the Weave contains a node with the specified identifier.Source§fn contains_active(&self, id: &K) -> bool
fn contains_active(&self, id: &K) -> bool
true if the Weave contains an active node (node.is_active() == true) with the specified identifier. Read moreSource§fn get(&self, id: &K) -> Option<&DependentNode<K, T, S>>
fn get(&self, id: &K) -> Option<&DependentNode<K, T, S>>
Source§fn get_parents(&self, id: &K) -> Option<&Option<K>>
fn get_parents(&self, id: &K) -> Option<&Option<K>>
self.get(id).map(Node::from).Auto Trait Implementations§
impl<K, T, M, S> !Freeze for DependentWeave<K, T, M, S>
impl<K, T, M, S> !Sync for DependentWeave<K, T, M, S>
impl<K, T, M, S> RefUnwindSafe for DependentWeave<K, T, M, S>where
HashMap<K, DependentNode<K, T, S>, S>: RefUnwindSafe,
IndexSet<K, S>: RefUnwindSafe,
Option<K>: RefUnwindSafe,
M: RefUnwindSafe,
impl<K, T, M, S> Send for DependentWeave<K, T, M, S>
impl<K, T, M, S> Unpin for DependentWeave<K, T, M, S>
impl<K, T, M, S> UnsafeUnpin for DependentWeave<K, T, M, S>where
HashMap<K, DependentNode<K, T, S>, S>: UnsafeUnpin,
IndexSet<K, S>: UnsafeUnpin,
Option<K>: UnsafeUnpin,
M: UnsafeUnpin,
impl<K, T, M, S> UnwindSafe for DependentWeave<K, T, M, S>where
HashMap<K, DependentNode<K, T, S>, S>: UnwindSafe,
IndexSet<K, S>: UnwindSafe,
Option<K>: UnwindSafe,
M: UnwindSafe,
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<T> ArchiveUnsized for Twhere
T: Archive,
impl<T> ArchiveUnsized for Twhere
T: Archive,
Source§type Archived = <T as Archive>::Archived
type Archived = <T as Archive>::Archived
Archive, it may be
unsized. Read moreSource§fn archived_metadata(
&self,
) -> <<T as ArchiveUnsized>::Archived as ArchivePointee>::ArchivedMetadata
fn archived_metadata( &self, ) -> <<T as ArchiveUnsized>::Archived as ArchivePointee>::ArchivedMetadata
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.