MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / iter_adjacent

Method iter_adjacent

atomic-core/src/pristine/inode_graph/scoped.rs:131–162  ·  view source on GitHub ↗
(
        &self,
        node: GraphNode<NodeId>,
        min_flag: EdgeFlags,
        max_flag: EdgeFlags,
    )

Source from the content-addressed store, hash-verified

129 type Adj = std::vec::IntoIter<Result<SerializedGraphEdge, PristineError>>;
130
131 fn iter_adjacent(
132 &self,
133 node: GraphNode<NodeId>,
134 min_flag: EdgeFlags,
135 max_flag: EdgeFlags,
136 ) -> Result<Self::Adj, PristineError> {
137 if !self.scoped {
138 return Ok(self
139 .inner
140 .iter_adjacent(node, min_flag, max_flag)?
141 .collect::<Vec<_>>()
142 .into_iter());
143 }
144 // `iter_inode_vertices`/`iter_inode_edges` select edges with
145 // `flag >= min_flag && flag <= max_flag`; mirror that exactly.
146 let out: Vec<Result<SerializedGraphEdge, PristineError>> = self
147 .adjacency
148 .get(&node)
149 .map(|edges| {
150 edges
151 .iter()
152 .filter(|edge| {
153 let flag = edge.flag();
154 flag >= min_flag && flag <= max_flag
155 })
156 .copied()
157 .map(Ok)
158 .collect()
159 })
160 .unwrap_or_default();
161 Ok(out.into_iter())
162 }
163
164 fn find_block(&self, pos: Position<NodeId>) -> Result<GraphNode<NodeId>, PristineError> {
165 if self.scoped {

Callers

nothing calls this directly

Calls 5

flagMethod · 0.80
getMethod · 0.65
into_iterMethod · 0.45
collectMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected