Struct rkyv::RawRelPtr[][src]

#[repr(transparent)]pub struct RawRelPtr { /* fields omitted */ }

An untyped pointer which resolves relative to its position in memory.

Implementations

impl RawRelPtr[src]

pub unsafe fn manual_check_bytes<'a, C: Fallible + ?Sized>(
    value: *const RawRelPtr,
    context: &mut C
) -> Result<&'a Self, Unreachable>
[src]

Checks the bytes of the given raw relative pointer.

This is done rather than implementing CheckBytes to force users to manually write their CheckBytes implementation since they need to also provide the ownership model of their memory.

Safety

The caller must guarantee that the given pointer is aligned and points to enough bytes to represent a RawRelPtr.

impl RawRelPtr[src]

pub fn new(from: usize, to: usize) -> Self[src]

Creates a new relative pointer between the given positions.

pub fn null() -> Self[src]

Creates a new relative pointer that has an offset of 0.

pub fn is_null(&self) -> bool[src]

Checks whether the relative pointer is null.

pub fn base(&self) -> *const u8[src]

Gets the base pointer for the relative pointer.

pub fn offset(&self) -> isize[src]

Gets the offset of the relative pointer.

pub fn as_ptr(&self) -> *const ()[src]

Calculates the memory address being pointed to by this relative pointer.

pub fn as_mut_ptr(&mut self) -> *mut ()[src]

Returns an unsafe mutable pointer to the memory address being pointed to by this relative pointer.

Trait Implementations

impl Debug for RawRelPtr[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> ArchivePointee for T[src]

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pointee for T[src]

type Metadata = ()

The type for metadata in pointers and references to Self.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.