Struct rkyv::rel_ptr::RelPtr [−][src]
pub struct RelPtr<T: ArchivePointee + ?Sized, O> { /* fields omitted */ }
Expand description
Implementations
pub unsafe fn manual_check_bytes<'a, C: Fallible + ?Sized>(
value: *const Self,
context: &mut C
) -> Result<&'a Self, <T::ArchivedMetadata as CheckBytes<C>>::Error> where
O: CheckBytes<C>,
T::ArchivedMetadata: CheckBytes<C>,
pub unsafe fn manual_check_bytes<'a, C: Fallible + ?Sized>(
value: *const Self,
context: &mut C
) -> Result<&'a Self, <T::ArchivedMetadata as CheckBytes<C>>::Error> where
O: CheckBytes<C>,
T::ArchivedMetadata: CheckBytes<C>,
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 given pointer must be aligned and point to enough bytes to represent a RelPtr<T>
.
Attempts to create a relative pointer from one position to another.
Safety
from
must be the position ofout
within the archiveto
must be the position of some validT
pub unsafe fn try_resolve_emplace<U: ArchiveUnsized<Archived = T> + ?Sized>(
from: usize,
to: usize,
value: &U,
metadata_resolver: U::MetadataResolver,
out: *mut Self
) -> Result<(), OffsetError>
pub unsafe fn try_resolve_emplace<U: ArchiveUnsized<Archived = T> + ?Sized>(
from: usize,
to: usize,
value: &U,
metadata_resolver: U::MetadataResolver,
out: *mut Self
) -> Result<(), OffsetError>
Attempts to create a relative pointer from one position to another.
Safety
from
must be the position ofout
within the archiveto
must be the position of some validT
value
must be the value being serializedmetadata_resolver
must be the result of serializing the metadata ofvalue
pub unsafe fn resolve_emplace<U: ArchiveUnsized<Archived = T> + ?Sized>(
from: usize,
to: usize,
value: &U,
metadata_resolver: U::MetadataResolver,
out: *mut Self
)
pub unsafe fn resolve_emplace<U: ArchiveUnsized<Archived = T> + ?Sized>(
from: usize,
to: usize,
value: &U,
metadata_resolver: U::MetadataResolver,
out: *mut Self
)
Creates a relative pointer from one position to another.
Panics
- The offset between
from
andto
does not fit in anisize
- The offset between
from
andto
exceeds the offset storage
Safety
from
must be the position ofout
within the archiveto
must be the position of some validT
value
must be the value being serializedmetadata_resolver
must be the result of serializing the metadata ofvalue
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, O> RefUnwindSafe for RelPtr<T, O> where
O: RefUnwindSafe,
T: RefUnwindSafe,
<T as ArchivePointee>::ArchivedMetadata: RefUnwindSafe,
impl<T: ?Sized, O> Send for RelPtr<T, O> where
O: Send,
T: Send,
<T as ArchivePointee>::ArchivedMetadata: Send,
impl<T: ?Sized, O> Sync for RelPtr<T, O> where
O: Sync,
T: Sync,
<T as ArchivePointee>::ArchivedMetadata: Sync,
impl<T: ?Sized, O> UnwindSafe for RelPtr<T, O> where
O: UnwindSafe,
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
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>,