A stable node ID is a hash of a node that should stay constant. This is used in order to remove duplicates from the graph. In the case of `skip_deduplication`, the `document_node_path` is also hashed in order to avoid duplicate monitor nodes from being removed (which would make it impossible to load thumbnails).
(&self)
| 153 | /// A stable node ID is a hash of a node that should stay constant. This is used in order to remove duplicates from the graph. |
| 154 | /// In the case of `skip_deduplication`, the `document_node_path` is also hashed in order to avoid duplicate monitor nodes from being removed (which would make it impossible to load thumbnails). |
| 155 | pub fn stable_node_id(&self) -> Option<NodeId> { |
| 156 | use std::hash::Hasher; |
| 157 | let mut hasher = rustc_hash::FxHasher::default(); |
| 158 | |
| 159 | self.identifier.as_str().hash(&mut hasher); |
| 160 | self.construction_args.cache_hash(&mut hasher); |
| 161 | if self.skip_deduplication { |
| 162 | self.original_location.path.hash(&mut hasher); |
| 163 | } |
| 164 | |
| 165 | std::mem::discriminant(&self.call_argument).hash(&mut hasher); |
| 166 | self.call_argument.hash(&mut hasher); |
| 167 | |
| 168 | Some(NodeId(hasher.finish())) |
| 169 | } |
| 170 | |
| 171 | /// Construct a new [`ProtoNode`] with the specified construction args and a `ClonedNode` implementation. |
| 172 | pub fn value(value: ConstructionArgs, path: Vec<NodeId>) -> Self { |
no test coverage detected