Struct rkyv::rel_ptr::RawRelPtr [−][src]
#[repr(transparent)]pub struct RawRelPtr<O> { /* fields omitted */ }
Expand description
An untyped pointer which resolves relative to its position in memory.
This is the most fundamental building block in rkyv. It allows the construction and use of pointers that can be safely reloacted as long as the source and target are moved together. This is what allows memory to be moved from disk into memory and accessed without decoding.
Regular pointers are absolute, meaning that the pointee can be moved without invalidating the pointer. However, the target cannot be moved or the pointer is invalidated.
Relative pointers are relative, meaning that the pointee can be moved with the target without invalidating the pointer. However, if either the pointee or the target move independently, the pointer will be invalidated.
Implementations
pub unsafe fn manual_check_bytes<'a, C: Fallible + ?Sized>(
value: *const Self,
context: &mut C
) -> Result<&'a Self, Infallible> where
O: CheckBytes<C>,
pub unsafe fn manual_check_bytes<'a, C: Fallible + ?Sized>(
value: *const Self,
context: &mut C
) -> Result<&'a Self, Infallible> where
O: CheckBytes<C>,
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 given pointer must be aligned and point to enough bytes to represent a RawRelPtr
.
Attempts to create a new RawRelPtr
in-place between the given from
and to
positions.
Safety
out
must be located at positionfrom
to
must be a position within the archive
Creates a new RawRelPtr
in-place between the given from
and to
positions.
Safety
out
must be located at positionfrom
to
must be a position within the archive- The offset between
from
andto
must fit in anisize
and not exceed the offset storage
Calculates the memory address being pointed to by this relative pointer.
Returns an unsafe mutable pointer to the memory address being pointed to by this relative pointer.
Trait Implementations
Auto Trait Implementations
impl<O> RefUnwindSafe for RawRelPtr<O> where
O: RefUnwindSafe,
impl<O> UnwindSafe for RawRelPtr<O> where
O: UnwindSafe,
Blanket Implementations
type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Converts some archived metadata to the pointer metadata for itself.
Mutably borrows from an owned value. Read more
impl<F, W, T, D> Deserialize<With<T, W>, D> for F where
D: Fallible + ?Sized,
F: ?Sized,
W: DeserializeWith<F, T, D>,
impl<F, W, T, D> Deserialize<With<T, W>, D> for F where
D: Fallible + ?Sized,
F: ?Sized,
W: DeserializeWith<F, T, D>,