x86_64
x86_64 copied to clipboard
Implement conversion traits for PhysAddr and VirtAddr
Implements the following conversions:
-
TryFrom<u64>
forVirtAddr
andPhysAddr
-
TryFrom<usize>
forVirtAddr
andPhysAddr
-
From<u32>
forVirtAddr
andPhysAddr
-
TryFrom<*const T>
forVirtAddr
-
TryFrom<*mut T>
forVirtAddr
-
From<&T>
forVirtAddr
-
From<&mut T>
forVirtAddr
-
From<VirtAddr>
foru64
,*const T
and*mut T
-
From<PhysAddr>
foru64
I restricted pointer and usize
conversions with #[cfg(any(target_pointer_width = "32", target_pointer_width = "64"))]
. This restriction isn't strictly necessary for TryFrom
, but without it we would need a different error type than what try_new
uses.
Closes #268. See also #293 (comment) by @josephlr.