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

Method next

atomic-core/src/change/graph_op.rs:498–593  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

496 type Item = AtomRef<'a, H>;
497
498 fn next(&mut self) -> Option<Self::Item> {
499 let result = match (self.graph_op, self.index) {
500 // FileAdd: add_name, add_inode, contents
501 (GraphOp::FileAdd { add_name, .. }, 0) => Some(AtomRef::Insertion(add_name)),
502 (GraphOp::FileAdd { add_inode, .. }, 1) => Some(AtomRef::Insertion(add_inode)),
503 (
504 GraphOp::FileAdd {
505 contents: Some(c), ..
506 },
507 2,
508 ) => Some(AtomRef::Insertion(c)),
509 (GraphOp::FileAdd { .. }, _) => None,
510
511 // FileDel: del, contents
512 (GraphOp::FileDel { del, .. }, 0) => Some(AtomRef::EdgeUpdate(del)),
513 (
514 GraphOp::FileDel {
515 contents: Some(c), ..
516 },
517 1,
518 ) => Some(AtomRef::EdgeUpdate(c)),
519 (GraphOp::FileDel { .. }, _) => None,
520
521 // FileUndel: undel, contents
522 (GraphOp::FileUndel { undel, .. }, 0) => Some(AtomRef::EdgeUpdate(undel)),
523 (
524 GraphOp::FileUndel {
525 contents: Some(c), ..
526 },
527 1,
528 ) => Some(AtomRef::EdgeUpdate(c)),
529 (GraphOp::FileUndel { .. }, _) => None,
530
531 // FileMove: del, add
532 (GraphOp::FileMove { del, .. }, 0) => Some(AtomRef::EdgeUpdate(del)),
533 (GraphOp::FileMove { add, .. }, 1) => Some(AtomRef::Insertion(add)),
534 (GraphOp::FileMove { .. }, _) => None,
535
536 // Edit: change
537 (GraphOp::Edit { change, .. }, 0) => Some(AtomRef::Atom(change)),
538 (GraphOp::Edit { .. }, _) => None,
539
540 // Replacement: change, replacement
541 (GraphOp::Replacement { change, .. }, 0) => Some(AtomRef::EdgeUpdate(change)),
542 (GraphOp::Replacement { replacement, .. }, 1) => Some(AtomRef::Insertion(replacement)),
543 (GraphOp::Replacement { .. }, _) => None,
544
545 // SolveNameConflict: name
546 (GraphOp::SolveNameConflict { name, .. }, 0) => Some(AtomRef::EdgeUpdate(name)),
547 (GraphOp::SolveNameConflict { .. }, _) => None,
548
549 // UnsolveNameConflict: name
550 (GraphOp::UnsolveNameConflict { name, .. }, 0) => Some(AtomRef::EdgeUpdate(name)),
551 (GraphOp::UnsolveNameConflict { .. }, _) => None,
552
553 // SolveOrderConflict: change
554 (GraphOp::SolveOrderConflict { change, .. }, 0) => Some(AtomRef::EdgeUpdate(change)),
555 (GraphOp::SolveOrderConflict { .. }, _) => None,

Callers 2

test_tracker_unresolvedFunction · 0.45
summaryMethod · 0.45

Calls 3

InsertionClass · 0.85
EdgeUpdateClass · 0.85
AtomEnum · 0.85

Tested by 1

test_tracker_unresolvedFunction · 0.36