Skip to content

Commit

Permalink
?Sized support for VirtAddr::from_ptr
Browse files Browse the repository at this point in the history
  • Loading branch information
Wasabi375 committed Oct 13, 2023
1 parent 135d18a commit 8b031b9
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/addr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,8 @@ impl VirtAddr {
// doesn't truncate.
#[cfg(any(target_pointer_width = "32", target_pointer_width = "64"))]
#[inline]
pub fn from_ptr<T>(ptr: *const T) -> Self {
Self::new(ptr as u64)
}

/// Creates a virtual address from the given slice.
#[cfg(target_pointer_width = "64")]
pub fn from_slice<T>(slice: &[T]) -> Self {
Self::new(slice as *const [T] as *const T as u64)
pub fn from_ptr<T: ?Sized>(ptr: *const T) -> Self {
Self::new(ptr as *const () as u64)
}

/// Converts the address to a raw pointer.
Expand Down

0 comments on commit 8b031b9

Please sign in to comment.