Struct rkyv::RelPtr [−][src]
pub struct RelPtr<T: ArchivePointee + ?Sized> { /* fields omitted */ }
Expand description
A pointer which resolves to relative to its position in memory.
See Archive
for an example of creating one.
Implementations
pub unsafe fn manual_check_bytes<'a, C: Fallible + ?Sized>(
value: *const RelPtr<T>,
context: &mut C
) -> Result<&'a Self, <T::ArchivedMetadata as CheckBytes<C>>::Error> where
T: CheckBytes<C>,
T::ArchivedMetadata: CheckBytes<C>,
[src]
pub unsafe fn manual_check_bytes<'a, C: Fallible + ?Sized>(
value: *const RelPtr<T>,
context: &mut C
) -> Result<&'a Self, <T::ArchivedMetadata as CheckBytes<C>>::Error> where
T: CheckBytes<C>,
T::ArchivedMetadata: CheckBytes<C>,
[src]Checks the bytes of the given 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 RelPtr<T>
.
Creates a new relative pointer from the given raw pointer and metadata.
Safety
The caller must guarantee that:
raw_ptr
is a valid relative pointer in its final positionraw_ptr
points to a valid valuemetadata
is valid metadata for the pointed value.
pub fn resolve_emplace<U: ArchiveUnsized<Archived = T> + ?Sized>(
from: usize,
to: usize,
value: &U,
metadata_resolver: U::MetadataResolver,
out: &mut MaybeUninit<Self>
)
[src]
pub fn resolve_emplace<U: ArchiveUnsized<Archived = T> + ?Sized>(
from: usize,
to: usize,
value: &U,
metadata_resolver: U::MetadataResolver,
out: &mut MaybeUninit<Self>
)
[src]Creates a relative pointer from one position to another.
Safety
The caller must guarantee that from
is the position of the relative pointer and to
is
the position of some valid memory.
Gets the metadata of the relative pointer.
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<T: ?Sized> RefUnwindSafe for RelPtr<T> where
T: RefUnwindSafe,
<T as ArchivePointee>::ArchivedMetadata: RefUnwindSafe,
impl<T: ?Sized> Send for RelPtr<T> where
T: Send,
<T as ArchivePointee>::ArchivedMetadata: Send,
impl<T: ?Sized> Sync for RelPtr<T> where
T: Sync,
<T as ArchivePointee>::ArchivedMetadata: Sync,
impl<T: ?Sized> UnwindSafe for RelPtr<T> where
T: UnwindSafe,
<T as ArchivePointee>::ArchivedMetadata: 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