MCPcopy Index your code
hub / github.com/encounter/objdiff / data_row_hover

Function data_row_hover

objdiff-core/src/diff/display.rs:519–549  ·  view source on GitHub ↗
(obj: &Object, diff_row: &DataDiffRow)

Source from the content-addressed store, hash-verified

517}
518
519pub fn data_row_hover(obj: &Object, diff_row: &DataDiffRow) -> Vec<HoverItem> {
520 let mut out = Vec::new();
521 let mut prev_reloc = None;
522 let mut first = true;
523 for reloc_diff in diff_row.relocations.iter() {
524 let reloc = &reloc_diff.reloc;
525 if prev_reloc == Some(reloc) {
526 // Avoid showing consecutive duplicate relocations.
527 // We do this because a single relocation can span across multiple diffs if the
528 // bytes in the relocation changed (e.g. first byte is added, second is unchanged).
529 continue;
530 }
531 prev_reloc = Some(reloc);
532
533 if first {
534 first = false;
535 } else {
536 out.push(HoverItem::Separator);
537 }
538
539 let reloc = resolve_relocation(&obj.symbols, reloc);
540 let color = match reloc_diff.kind {
541 DataDiffKind::None => HoverItemColor::Normal,
542 DataDiffKind::Replace => HoverItemColor::Special,
543 DataDiffKind::Delete => HoverItemColor::Delete,
544 DataDiffKind::Insert => HoverItemColor::Insert,
545 };
546 out.append(&mut relocation_hover(obj, reloc, Some(color)));
547 }
548 out
549}
550
551pub fn data_row_context(obj: &Object, diff_row: &DataDiffRow) -> Vec<ContextItem> {
552 let mut out = Vec::new();

Callers 2

data_hoverMethod · 0.85
data_row_hover_uiFunction · 0.85

Calls 3

resolve_relocationFunction · 0.85
relocation_hoverFunction · 0.85
pushMethod · 0.80

Tested by

no test coverage detected