[pvmfw] Define RangeExt trait on Range datatype

'is_within' of within RangeExt trait helps test if one range is
contained within another range. This will avoid duplicating the same
code in multiple places.

Test: m pvmfw_img
Bug: 271493784
Change-Id: I3fb76706620593efb45ce607eaf61d280c5a4a6c
diff --git a/pvmfw/src/memory.rs b/pvmfw/src/memory.rs
index 7df25f2..714815b 100644
--- a/pvmfw/src/memory.rs
+++ b/pvmfw/src/memory.rs
@@ -16,7 +16,7 @@
 
 #![deny(unsafe_op_in_unsafe_fn)]
 
-use crate::helpers::{self, align_down, align_up, page_4kb_of, SIZE_4KB, SIZE_4MB};
+use crate::helpers::{self, align_down, align_up, page_4kb_of, RangeExt, SIZE_4KB, SIZE_4MB};
 use crate::mmu;
 use alloc::alloc::alloc_zeroed;
 use alloc::alloc::dealloc;
@@ -65,8 +65,7 @@
 
     /// True if the instance is fully contained within the passed range.
     pub fn is_within(&self, range: &MemoryRange) -> bool {
-        let our: &MemoryRange = self.as_ref();
-        self.as_ref() == &(max(our.start, range.start)..min(our.end, range.end))
+        self.as_ref().is_within(range)
     }
 }