pub struct VPtr {
pub alloc_id: u8,
pub offset: u32,
pub size: u32,
}Expand description
Fat pointer for verified heap operations.
Contains allocation metadata for bounds checking without borrowing the heap.
Fields§
§alloc_id: u8Which allocation this points into.
offset: u32Current byte offset within the allocation.
size: u32Total size of the allocation (for bounds checking).
Implementations§
Source§impl VPtr
impl VPtr
Sourcepub const fn new(alloc_id: u8, size: u32) -> Self
pub const fn new(alloc_id: u8, size: u32) -> Self
Create a new pointer to the start of an allocation.
Sourcepub fn offset(self, n: usize) -> Self
pub fn offset(self, n: usize) -> Self
Compute a new pointer at an offset from this one.
§Panics
Panics if the resulting offset would exceed the allocation size.
Sourcepub const fn offset_bytes(self) -> usize
pub const fn offset_bytes(self) -> usize
Returns the current offset within the allocation.
Sourcepub const fn alloc_size(self) -> usize
pub const fn alloc_size(self) -> usize
Returns the total size of the allocation.
Sourcepub const fn is_at_start(self) -> bool
pub const fn is_at_start(self) -> bool
Check if this pointer is at the start of its allocation.
Trait Implementations§
impl Copy for VPtr
impl Eq for VPtr
impl StructuralPartialEq for VPtr
Auto Trait Implementations§
impl Freeze for VPtr
impl RefUnwindSafe for VPtr
impl Send for VPtr
impl Sync for VPtr
impl Unpin for VPtr
impl UnsafeUnpin for VPtr
impl UnwindSafe for VPtr
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more