#[derive(Debug, Clone, Copy, PartialEq, PartialOrd, Eq, Ord)]
pub struct MemoryHandle {
pub offset: u64,
pub length: u64,
}
impl MemoryHandle {
pub unsafe fn new(offset: u64, length: u64) -> MemoryHandle {
MemoryHandle { offset, length }
}
pub fn null() -> MemoryHandle {
MemoryHandle {
offset: 0,
length: 0,
}
}
pub fn offset(&self) -> u64 {
self.offset
}
pub fn len(&self) -> usize {
self.length as usize
}
pub fn is_empty(&self) -> bool {
self.length == 0
}
}