@@ -444,6 +444,17 @@ impl<'a> ChangeRef<'a> {
444
444
| ChangeRef :: Rewrite { location, .. } => location,
445
445
}
446
446
}
447
+
448
+ /// Return the *previous* location of the resource where possible, i.e. the source of a rename or copy, or the
449
+ /// location at which an addition, deletion or modification took place.
450
+ pub fn source_location ( & self ) -> & BStr {
451
+ match self {
452
+ ChangeRef :: Addition { location, .. }
453
+ | ChangeRef :: Deletion { location, .. }
454
+ | ChangeRef :: Modification { location, .. } => location,
455
+ ChangeRef :: Rewrite { source_location, .. } => source_location,
456
+ }
457
+ }
447
458
}
448
459
449
460
impl Change {
@@ -477,4 +488,15 @@ impl Change {
477
488
| Change :: Rewrite { location, .. } => location. as_bstr ( ) ,
478
489
}
479
490
}
491
+
492
+ /// Return the *previous* location of the resource where possible, i.e. the source of a rename or copy, or the
493
+ /// location at which an addition, deletion or modification took place.
494
+ pub fn source_location ( & self ) -> & BStr {
495
+ match self {
496
+ Change :: Addition { location, .. }
497
+ | Change :: Deletion { location, .. }
498
+ | Change :: Modification { location, .. } => location. as_bstr ( ) ,
499
+ Change :: Rewrite { source_location, .. } => source_location. as_bstr ( ) ,
500
+ }
501
+ }
480
502
}
0 commit comments