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

Function adjust_for_mid_span

atomic-core/src/apply/position.rs:283–311  ·  view source on GitHub ↗
(
    found: GraphNode<NodeId>,
    pos: Position<NodeId>,
    is_predecessor: bool,
)

Source from the content-addressed store, hash-verified

281/// logic has a single definition.
282#[inline]
283pub(crate) fn adjust_for_mid_span(
284 found: GraphNode<NodeId>,
285 pos: Position<NodeId>,
286 is_predecessor: bool,
287) -> GraphNode<NodeId> {
288 if is_predecessor {
289 // Predecessor: return the portion up to `pos`
290 if found.end > pos.pos && found.start < pos.pos {
291 GraphNode {
292 change: found.change,
293 start: found.start,
294 end: pos.pos,
295 }
296 } else {
297 found
298 }
299 } else {
300 // Successor: return the portion from `pos` onward
301 if found.start < pos.pos && found.end > pos.pos {
302 GraphNode {
303 change: found.change,
304 start: pos.pos,
305 end: found.end,
306 }
307 } else {
308 found
309 }
310 }
311}
312
313// Tests
314

Callers 1

resolve_context_vertexFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected