Skip to main content

DependentWeave

Struct DependentWeave 

Source
pub struct DependentWeave<K, T, M, S>
where K: Hash + Copy + Eq + Ord, S: BuildHasher + Default + Clone,
{ pub metadata: M, /* private fields */ }
Expand description

A tree-based Weave where each Node depends on the contents of the previous Node.

Fields§

§metadata: M

The metadata associated with the weave.

Implementations§

Source§

impl<K, T, M, S> DependentWeave<K, T, M, S>
where K: Hash + Copy + Eq + Ord, S: BuildHasher + Default + Clone,

Source

pub fn with_capacity(capacity: usize, metadata: M) -> Self

Creates a new, empty DependentWeave with at least the specified capacity.

§Contracts

Post-condition: ret.nodes.is_empty()

Post-condition: ret.validate()

Source

pub fn capacity(&self) -> usize

Returns the number of nodes the weave can hold without reallocating.

Source

pub fn reserve(&mut self, additional: usize)

Reserves capacity for at least additional more nodes.

§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

pub fn shrink_to(&mut self, min_capacity: usize)

Shrinks the capacity of the weave with a lower limit.

§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> DependentWeave<K, T, M, S>
where K: Hash + Copy + Eq + Ord, S: BuildHasher + Default + Clone,

Source

pub fn validate(&self) -> bool

Validates that the weave is internally consistent.

Trait Implementations§

Source§

impl<K, T, M, S> ActionableWeave<K, DependentNode<K, T, S>, T, M, S> for DependentWeave<K, T, M, S>

Source§

fn apply(&mut self, action: WeaveAction<K, DependentNode<K, T, S>, T, M>)

Applies a WeaveAction to a Weave. Read more
Source§

impl<K, T, M, S> ActiveSingularWeave<K, DependentNode<K, T, S>, T> for DependentWeave<K, T, M, S>
where K: Hash + Copy + Eq + Ord, S: BuildHasher + Default + Clone,

Source§

fn active(&self) -> Option<K>

Returns the active node’s identifier, if any.
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<Vec<K>>, M: Archive,

Source§

type Archived = ArchivedDependentWeave<K, T, M, S>

The archived representation of this type. Read more
Source§

type Resolver = DependentWeaveResolver<K, T, M, S>

The resolver for this type. It must contain all the additional information from serializing needed to make the archived type from the normal type.
Source§

fn resolve(&self, resolver: Self::Resolver, out: Place<Self::Archived>)

Creates the archived version of this value at the given position and writes it to the given output. Read more
Source§

const COPY_OPTIMIZATION: CopyOptimization<Self> = _

An optimization flag that allows the bytes of this type to be copied directly to a writer instead of calling serialize. Read more
Source§

impl<K, T, M, S> BookmarkableWeave<K, DependentNode<K, T, S>, T> for DependentWeave<K, T, M, S>
where K: Hash + Copy + Eq + Ord, S: BuildHasher + Default + Clone,

Source§

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) == self.active

Invariant: self.validate()

Source§

type Bookmarks = IndexSet<K, S>

Identifiers of bookmarked nodes.
Source§

fn bookmarks(&self) -> &Self::Bookmarks

Returns a reference to the identifiers of bookmarked nodes.
Source§

fn contains_bookmark(&self, id: &K) -> bool

Returns 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>
where K: Hash + Copy + Eq + Ord + Clone, S: BuildHasher + Default + Clone + Clone,

Source§

fn clone(&self) -> DependentWeave<K, T, M, S>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<K, T: Debug, M: Debug, S> Debug for DependentWeave<K, T, M, S>
where K: Hash + Copy + Eq + Ord + Debug, S: BuildHasher + Default + Clone + Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<K, T, M, S> DeduplicatableWeave<K, DependentNode<K, T, S>, T> for DependentWeave<K, T, M, S>

Source§

fn find_duplicates(&self, id: &K) -> impl Iterator<Item = K>

An iterator over the specified node’s sibling identifiers which contain contents which are duplicates of the specified node’s contents.
Source§

impl<K, T: Default, M: Default, S> Default for DependentWeave<K, T, M, S>
where K: Hash + Copy + Eq + Ord + Default, S: BuildHasher + Default + Clone + Default,

Source§

fn default() -> DependentWeave<K, T, M, S>

Returns the “default value” for a type. Read more
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<Vec<K>> + DeserializeWith<<Skip as ArchiveWith<Vec<K>>>::Archived, Vec<K>, __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>

Deserializes using the given deserializer
Source§

impl<K, T, M, S> DiscreteWeave<K, DependentNode<K, T, S>, T> for DependentWeave<K, T, M, S>
where K: Hash + Copy + Eq + Ord, T: DiscreteContents, S: BuildHasher + Default + Clone,

Source§

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 == 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>

§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()

Source§

impl<K, T, M, S> Eq for DependentWeave<K, T, M, S>
where K: Hash + Copy + Eq + Ord, T: Eq, M: Eq, S: BuildHasher + Default + Clone,

Source§

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

Converts to this type from the input type.
Source§

impl<K, T, M, S> MetadataWeave<K, DependentNode<K, T, S>, T, M> for DependentWeave<K, T, M, S>
where K: Hash + Copy + Eq + Ord, S: BuildHasher + Default + Clone,

Source§

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§

fn metadata(&self) -> &M

Returns a reference to the Weave’s associated metadata.
Source§

impl<K, T, M, S> PartialEq for DependentWeave<K, T, M, S>
where K: Hash + Copy + Eq + Ord, T: PartialEq, M: PartialEq, S: BuildHasher + Default + Clone,

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

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>

§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<Vec<K>, __S>, M: Serialize<__S>,

Source§

fn serialize( &self, serializer: &mut __S, ) -> Result<<Self as Archive>::Resolver, <__S as Fallible>::Error>

Writes the dependencies for the object and returns a resolver that can create the archived type.
Source§

impl<K, T, M, S> SortableBookmarkableWeave<K, DependentNode<K, T, S>, T> for DependentWeave<K, T, M, S>
where K: Hash + Copy + Eq + Ord, S: BuildHasher + Default + Clone,

Source§

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)

§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>
where K: Hash + Copy + Eq + Ord, S: BuildHasher + Default + Clone,

Source§

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) == 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>, )

§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 sort_node_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_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) == 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, )

§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)

§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>

Source§

type Error = IndependentWeave<K, T, M, S>

The type returned in the event of a conversion error.
Source§

fn try_from(value: IndependentWeave<K, T, M, S>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<K, T, M, S> Weave<K, DependentNode<K, T, S>, T> for DependentWeave<K, T, M, S>
where K: Hash + Copy + Eq + Ord, S: BuildHasher + Default + Clone,

Source§

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) == 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>)

§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>)

§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>)

§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 add_node(&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_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) == 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<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_node_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§

fn remove_all_nodes(&mut self)

§Contracts

Post-condition: self.nodes.is_empty()

Post-condition: self.validate()

Source§

type Nodes = HashMap<K, DependentNode<K, T, S>, S>

Mapping between identifiers and nodes.
Source§

type Roots = IndexSet<K, S>

Identifiers of root nodes (nodes which do not have any parents).
Source§

fn len(&self) -> usize

Returns the number of nodes stored within the Weave.
Source§

fn is_empty(&self) -> bool

Returns true if the Weave does not contain any nodes.
Source§

fn nodes(&self) -> &Self::Nodes

Returns a reference to the identifier:node mapping.
Source§

fn roots(&self) -> &Self::Roots

Returns a reference to the identifiers of root nodes (nodes which do not have any parents).
Source§

fn contains(&self, id: &K) -> bool

Returns true if the Weave contains a node with the specified identifier.
Source§

fn contains_active(&self, id: &K) -> bool

Returns true if the Weave contains an active node (node.is_active() == true) with the specified identifier. Read more
Source§

fn get_node(&self, id: &K) -> Option<&DependentNode<K, T, S>>

Returns a reference to the node corresponding to the identifier.

Auto Trait Implementations§

§

impl<K, T, M, S> Freeze for DependentWeave<K, T, M, S>
where M: Freeze, S: Freeze, K: Freeze,

§

impl<K, T, M, S> RefUnwindSafe for DependentWeave<K, T, M, S>

§

impl<K, T, M, S> Send for DependentWeave<K, T, M, S>
where M: Send, S: Send, K: Send, T: Send,

§

impl<K, T, M, S> Sync for DependentWeave<K, T, M, S>
where M: Sync, S: Sync, K: Sync, T: Sync,

§

impl<K, T, M, S> Unpin for DependentWeave<K, T, M, S>
where M: Unpin, S: Unpin, K: Unpin, T: Unpin,

§

impl<K, T, M, S> UnsafeUnpin for DependentWeave<K, T, M, S>

§

impl<K, T, M, S> UnwindSafe for DependentWeave<K, T, M, S>

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

Source§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
Source§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
Source§

impl<T> ArchiveUnsized for T
where T: Archive,

Source§

type Archived = <T as Archive>::Archived

The archived counterpart of this type. Unlike Archive, it may be unsized. Read more
Source§

fn archived_metadata( &self, ) -> <<T as ArchiveUnsized>::Archived as ArchivePointee>::ArchivedMetadata

Creates the archived version of the metadata for this value.
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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> LayoutRaw for T

Source§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Returns the layout of the type.
Source§

impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
where T: SharedNiching<N1, N2>, N1: Niching<T>, N2: Niching<T>,

Source§

unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool

Returns whether the given value has been niched. Read more
Source§

fn resolve_niched(out: Place<NichedOption<T, N1>>)

Writes data to out indicating that a T is niched.
Source§

impl<T> Pointee for T

Source§

type Metadata = ()

The metadata type for pointers and references to this type.
Source§

impl<T, S> SerializeUnsized<S> for T
where T: Serialize<S>, S: Fallible + Writer + ?Sized,

Source§

fn serialize_unsized( &self, serializer: &mut S, ) -> Result<usize, <S as Fallible>::Error>

Writes the object and returns the position of the archived type.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.