pub struct IndependentNode<K, T, S>{
pub id: K,
pub from: IndexSet<K, S>,
pub to: IndexSet<K, S>,
pub active: bool,
pub bookmarked: bool,
pub contents: T,
}Expand description
A Node in a IndependentWeave document.
Fields§
§id: KThe node’s unique identifier.
from: IndexSet<K, S>The identifiers corresponding to the node’s parents.
to: IndexSet<K, S>The identifiers corresponding to the node’s children.
active: boolIf the node should be considered active.
Unlike DependentWeave, IndependentWeave considers all nodes within an active path to be active.
bookmarked: boolIf the node is bookmarked.
contents: TThe node’s contents.
Trait Implementations§
Source§impl<K, T, M, S> ActionableWeave<K, IndependentNode<K, T, S>, T, M, S> for IndependentWeave<K, T, M, S>where
K: Hash + Copy + Eq + Ord,
T: IndependentContents + DiscreteContents,
S: BuildHasher + Default + Clone,
impl<K, T, M, S> ActionableWeave<K, IndependentNode<K, T, S>, T, M, S> for IndependentWeave<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, IndependentNode<K, T, S>, T, M>)
fn apply(&mut self, action: WeaveAction<K, IndependentNode<K, T, S>, T, M>)
Source§impl<K, T, M, S> ActivePathWeave<K, IndependentNode<K, T, S>, T> for IndependentWeave<K, T, M, S>
impl<K, T, M, S> ActivePathWeave<K, IndependentNode<K, T, S>, T> for IndependentWeave<K, T, M, S>
Source§fn set_active_path(&mut self, active: impl Iterator<Item = K>)
fn set_active_path(&mut self, active: impl Iterator<Item = K>)
§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.bookmarked.clone()) == self.bookmarked
Invariant: self.validate()
Source§impl<K, T, S> Archive for IndependentNode<K, T, S>
impl<K, T, S> Archive for IndependentNode<K, T, S>
Source§type Archived = ArchivedIndependentNode<K, T, S>
type Archived = ArchivedIndependentNode<K, T, S>
Source§type Resolver = IndependentNodeResolver<K, T, S>
type Resolver = IndependentNodeResolver<K, T, 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, IndependentNode<K, T, S>, T> for IndependentWeave<K, T, M, S>
impl<K, T, M, S> BookmarkableWeave<K, IndependentNode<K, T, S>, T> for IndependentWeave<K, T, M, S>
Source§fn set_node_bookmarked_status(&mut self, id: &K, value: bool) -> bool
fn set_node_bookmarked_status(&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.clone()) == 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, S> Clone for IndependentNode<K, T, S>
impl<K, T, S> Clone for IndependentNode<K, T, S>
Source§fn clone(&self) -> IndependentNode<K, T, S>
fn clone(&self) -> IndependentNode<K, T, 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, S> Debug for IndependentNode<K, T, S>
impl<K, T, S> Debug for IndependentNode<K, T, S>
Source§impl<K, T, M, S> DeduplicatableWeave<K, IndependentNode<K, T, S>, T> for IndependentWeave<K, T, M, S>where
K: Hash + Copy + Eq + Ord,
T: IndependentContents + DeduplicatableContents,
S: BuildHasher + Default + Clone,
impl<K, T, M, S> DeduplicatableWeave<K, IndependentNode<K, T, S>, T> for IndependentWeave<K, T, M, S>where
K: Hash + Copy + Eq + Ord,
T: IndependentContents + DeduplicatableContents,
S: BuildHasher + Default + Clone,
Source§fn find_duplicates(&self, id: &K) -> impl Iterator<Item = K>
fn find_duplicates(&self, id: &K) -> impl Iterator<Item = K>
Source§impl<K, T, S> Default for IndependentNode<K, T, S>
impl<K, T, S> Default for IndependentNode<K, T, S>
Source§fn default() -> IndependentNode<K, T, S>
fn default() -> IndependentNode<K, T, S>
Source§impl<__D: Fallible + ?Sized, K, T, S> Deserialize<IndependentNode<K, T, S>, __D> for Archived<IndependentNode<K, T, S>>where
K: Hash + Copy + Eq + Ord + Archive,
T: IndependentContents + Archive,
S: BuildHasher + Default + Clone,
<K as Archive>::Archived: Deserialize<K, __D>,
IndexSet<K, S>: Archive,
<IndexSet<K, S> as Archive>::Archived: Deserialize<IndexSet<K, S>, __D>,
bool: Archive,
<bool as Archive>::Archived: Deserialize<bool, __D>,
<T as Archive>::Archived: Deserialize<T, __D>,
impl<__D: Fallible + ?Sized, K, T, S> Deserialize<IndependentNode<K, T, S>, __D> for Archived<IndependentNode<K, T, S>>where
K: Hash + Copy + Eq + Ord + Archive,
T: IndependentContents + Archive,
S: BuildHasher + Default + Clone,
<K as Archive>::Archived: Deserialize<K, __D>,
IndexSet<K, S>: Archive,
<IndexSet<K, S> as Archive>::Archived: Deserialize<IndexSet<K, S>, __D>,
bool: Archive,
<bool as Archive>::Archived: Deserialize<bool, __D>,
<T as Archive>::Archived: Deserialize<T, __D>,
Source§fn deserialize(
&self,
deserializer: &mut __D,
) -> Result<IndependentNode<K, T, S>, <__D as Fallible>::Error>
fn deserialize( &self, deserializer: &mut __D, ) -> Result<IndependentNode<K, T, S>, <__D as Fallible>::Error>
Source§impl<K, T, M, S> DiscreteWeave<K, IndependentNode<K, T, S>, T> for IndependentWeave<K, T, M, S>where
K: Hash + Copy + Eq + Ord,
T: IndependentContents + DiscreteContents,
S: BuildHasher + Default + Clone,
impl<K, T, M, S> DiscreteWeave<K, IndependentNode<K, T, S>, T> for IndependentWeave<K, T, M, S>where
K: Hash + Copy + Eq + Ord,
T: IndependentContents + DiscreteContents,
S: BuildHasher + Default + Clone,
Source§fn split_node(&mut self, id: &K, at: usize, new_id: K) -> bool
fn split_node(&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.contains(id) && self.nodes [&new_id].from.len() == 1
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: ret || old(self.active.clone()) == self.active
Post-condition: old(self.roots.clone()) == self.roots
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.nodes.get(id).and_then(|n| n.from.first()).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.first()).and_then(|p| self.nodes.get(p)).map(|p| p.from.clone())).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() || old(self.nodes.get(id).map(|node| node.from.len() == 1)).unwrap()
Post-condition: ret.is_none() || ret.unwrap() == old(self.nodes.get(id).and_then(|node| node.from.first().copied())).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.clone()) == 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, S> Eq for IndependentNode<K, T, S>
Source§impl<K, T, S> From<DependentNode<K, T, S>> for IndependentNode<K, T, S>
impl<K, T, S> From<DependentNode<K, T, S>> for IndependentNode<K, T, S>
Source§fn from(value: DependentNode<K, T, S>) -> Self
fn from(value: DependentNode<K, T, S>) -> Self
Source§impl<K, T, M, S> IndependentWeave<K, IndependentNode<K, T, S>, T> for IndependentWeave<K, T, M, S>
impl<K, T, M, S> IndependentWeave<K, IndependentNode<K, T, S>, T> for IndependentWeave<K, T, M, S>
Source§fn move_node(&mut self, id: &K, new_parents: &[K]) -> bool
fn move_node(&mut self, id: &K, new_parents: &[K]) -> bool
§Contracts
Post-condition: ! ret || self.nodes [id].from.iter().copied().collect ::< HashSet < _ >> () == new_parents.iter().copied().collect ::< HashSet < _ >> ()
Post-condition: ret || old(self.nodes().get(id).map(|node| node.from.clone())).as_ref() == self.nodes().get(id).map(|node| &node.from)
Post-condition: ret || old(self.roots.clone()) == self.roots
Post-condition: ret || old(self.active.clone()) == self.active
Post-condition: old(self.nodes().get(id).map(|node| node.to.clone())).as_ref() == self.nodes().get(id).map(|node| &node.to)
Post-condition: old(self.nodes.keys().copied().collect::<HashSet<_>>()) == self.nodes.keys().copied().collect ::< HashSet < _ >> ()
Post-condition: old(self.bookmarked.clone()) == self.bookmarked
Post-condition: old(self.active.contains(id)) == self.active.contains(id)
Invariant: self.validate()
Source§impl<K, T, M, S> MetadataWeave<K, IndependentNode<K, T, S>, T, M> for IndependentWeave<K, T, M, S>
impl<K, T, M, S> MetadataWeave<K, IndependentNode<K, T, S>, T, M> for IndependentWeave<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.clone()) == self.active
Post-condition: old(self.bookmarked.clone()) == self.bookmarked
Invariant: self.validate()
Source§impl<K, T, S> Node<K, T> for IndependentNode<K, T, S>
impl<K, T, S> Node<K, T> for IndependentNode<K, T, S>
Source§impl<K, T, S> PartialEq for IndependentNode<K, T, S>where
K: Hash + Copy + Eq + Ord,
T: IndependentContents + PartialEq,
S: BuildHasher + Default + Clone,
impl<K, T, S> PartialEq for IndependentNode<K, T, S>where
K: Hash + Copy + Eq + Ord,
T: IndependentContents + PartialEq,
S: BuildHasher + Default + Clone,
Source§impl<K, T, M, S> SemiIndependentWeave<K, IndependentNode<K, T, S>, T> for IndependentWeave<K, T, M, S>
impl<K, T, M, S> SemiIndependentWeave<K, IndependentNode<K, T, S>, T> for IndependentWeave<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.clone()) == self.active
Post-condition: old(self.bookmarked.clone()) == self.bookmarked
Invariant: self.validate()
Source§impl<K, T, M, S> SortableBookmarkableWeave<K, IndependentNode<K, T, S>, T> for IndependentWeave<K, T, M, S>
impl<K, T, M, S> SortableBookmarkableWeave<K, IndependentNode<K, T, S>, T> for IndependentWeave<K, T, M, S>
Source§fn sort_bookmarks_by(
&mut self,
cmp: impl FnMut(&IndependentNode<K, T, S>, &IndependentNode<K, T, S>) -> Ordering,
)
fn sort_bookmarks_by( &mut self, cmp: impl FnMut(&IndependentNode<K, T, S>, &IndependentNode<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.clone()) == 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.clone()) == self.active
Post-condition: old(self.bookmarked.clone()) == self.bookmarked
Invariant: self.validate()
Source§impl<K, T, M, S> SortableWeave<K, IndependentNode<K, T, S>, T> for IndependentWeave<K, T, M, S>
impl<K, T, M, S> SortableWeave<K, IndependentNode<K, T, S>, T> for IndependentWeave<K, T, M, S>
Source§fn get_ordered_node_identifiers_mirrored(&mut self, output: &mut Vec<K>)
fn get_ordered_node_identifiers_mirrored(&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.clone()) == self.active
Post-condition: old(self.bookmarked.clone()) == self.bookmarked
Invariant: self.validate()
Source§fn get_ordered_node_identifiers_mirrored_from(
&mut self,
id: &K,
output: &mut Vec<K>,
)
fn get_ordered_node_identifiers_mirrored_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.clone()) == self.active
Post-condition: old(self.bookmarked.clone()) == self.bookmarked
Invariant: self.validate()
Source§fn sort_node_children_by(
&mut self,
id: &K,
cmp: impl FnMut(&IndependentNode<K, T, S>, &IndependentNode<K, T, S>) -> Ordering,
) -> bool
fn sort_node_children_by( &mut self, id: &K, cmp: impl FnMut(&IndependentNode<K, T, S>, &IndependentNode<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.clone()) == self.active
Post-condition: old(self.bookmarked.clone()) == self.bookmarked
Invariant: self.validate()
Source§fn sort_node_children_by_id(
&mut self,
id: &K,
cmp: impl FnMut(&K, &K) -> Ordering,
) -> bool
fn sort_node_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.clone()) == self.active
Post-condition: old(self.bookmarked.clone()) == self.bookmarked
Invariant: self.validate()
Source§fn sort_roots_by(
&mut self,
cmp: impl FnMut(&IndependentNode<K, T, S>, &IndependentNode<K, T, S>) -> Ordering,
)
fn sort_roots_by( &mut self, cmp: impl FnMut(&IndependentNode<K, T, S>, &IndependentNode<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.clone()) == 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.clone()) == self.active
Post-condition: old(self.bookmarked.clone()) == self.bookmarked
Invariant: self.validate()
Source§impl<K, T, S> TryFrom<IndependentNode<K, T, S>> for DependentNode<K, T, S>
impl<K, T, S> TryFrom<IndependentNode<K, T, S>> for DependentNode<K, T, S>
Source§type Error = IndependentNode<K, T, S>
type Error = IndependentNode<K, T, S>
Source§impl<K, T, M, S> Weave<K, IndependentNode<K, T, S>, T> for IndependentWeave<K, T, M, S>
impl<K, T, M, S> Weave<K, IndependentNode<K, T, S>, T> for IndependentWeave<K, T, M, S>
Source§fn get_ordered_node_identifiers(&mut self, output: &mut Vec<K>)
fn get_ordered_node_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.clone()) == self.active
Post-condition: old(self.bookmarked.clone()) == self.bookmarked
Invariant: self.validate()
Source§fn get_ordered_node_identifiers_from(&mut self, id: &K, output: &mut Vec<K>)
fn get_ordered_node_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.clone()) == 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: output.len() == self.active.len()
Post-condition: output.iter().all(|i| self.active.contains(i))
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.clone()) == 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.clone()) == self.active
Post-condition: old(self.bookmarked.clone()) == self.bookmarked
Invariant: self.validate()
Source§fn add_node(&mut self, node: IndependentNode<K, T, S>) -> bool
fn add_node(&mut self, node: IndependentNode<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.contains(&old(node.id)) || (!old(node.active) && self.active.contains(&old(node.id)) && old(node.to.iter().any(|c| self.active.contains(c))))
Post-condition: ! ret || old(node.bookmarked) == self.bookmarked.contains(&old(node.id))
Post-condition: ! ret || old(!node.from.is_empty()) || self.roots.contains(&old(node.id))
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.clone()) == self.active
Post-condition: ret || old(self.bookmarked.clone()) == self.bookmarked
Invariant: self.validate()
Source§fn set_node_active_status(&mut self, id: &K, value: bool) -> bool
fn set_node_active_status(&mut self, id: &K, value: bool) -> bool
§Contracts
Post-condition: ! ret || value == self.contains_active(id)
Post-condition: ret || old(self.active.clone()) == 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_node(&mut self, id: &K) -> Option<IndependentNode<K, T, S>>
fn remove_node(&mut self, id: &K) -> Option<IndependentNode<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.active.len()) >= self.active.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.clone()) == self.active
Post-condition: ret.is_some() || old(self.bookmarked.clone()) == self.bookmarked
Invariant: self.validate()
Source§fn remove_node_tracked(
&mut self,
id: &K,
on_removal: impl FnMut(IndependentNode<K, T, S>),
) -> bool
fn remove_node_tracked( &mut self, id: &K, on_removal: impl FnMut(IndependentNode<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.active.len()) >= self.active.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.clone()) == self.active
Post-condition: ret || old(self.bookmarked.clone()) == self.bookmarked
Invariant: self.validate()
Source§fn remove_all_nodes(&mut self)
fn remove_all_nodes(&mut self)
Source§type Nodes = HashMap<K, IndependentNode<K, T, S>, S>
type Nodes = HashMap<K, IndependentNode<K, T, S>, 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.Auto Trait Implementations§
impl<K, T, S> Freeze for IndependentNode<K, T, S>
impl<K, T, S> RefUnwindSafe for IndependentNode<K, T, S>
impl<K, T, S> Send for IndependentNode<K, T, S>
impl<K, T, S> Sync for IndependentNode<K, T, S>
impl<K, T, S> Unpin for IndependentNode<K, T, S>
impl<K, T, S> UnsafeUnpin for IndependentNode<K, T, S>
impl<K, T, S> UnwindSafe for IndependentNode<K, T, S>
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.