pub struct RelPtr<T: ArchivePointee + ?Sized, O> { /* private fields */ }Expand description
Implementations§
Source§impl<T, O: Offset> RelPtr<T, O>
 
impl<T, O: Offset> RelPtr<T, O>
Sourcepub unsafe fn try_emplace(
    from: usize,
    to: usize,
    out: *mut Self,
) -> Result<(), OffsetError>
 
pub unsafe fn try_emplace( from: usize, to: usize, out: *mut Self, ) -> Result<(), OffsetError>
Attempts to create a relative pointer from one position to another.
§Safety
frommust be the position ofoutwithin the archivetomust be the position of some validT
Source§impl<T: ArchivePointee + ?Sized, O: Offset> RelPtr<T, O>where
    T::ArchivedMetadata: Default,
 
impl<T: ArchivePointee + ?Sized, O: Offset> RelPtr<T, O>where
    T::ArchivedMetadata: Default,
Sourcepub unsafe fn try_emplace_null(
    pos: usize,
    out: *mut Self,
) -> Result<(), OffsetError>
 
pub unsafe fn try_emplace_null( pos: usize, out: *mut Self, ) -> Result<(), OffsetError>
Attempts to create a null relative pointer with default metadata.
§Safety
pos must be the position of out within the archive.
Source§impl<T: ArchivePointee + ?Sized, O: Offset> RelPtr<T, O>
 
impl<T: ArchivePointee + ?Sized, O: Offset> RelPtr<T, O>
Sourcepub 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
frommust be the position ofoutwithin the archivetomust be the position of some validTvaluemust be the value being serializedmetadata_resolvermust be the result of serializing the metadata ofvalue
Sourcepub 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 
fromandtodoes not fit in anisize - The offset between 
fromandtoexceeds the offset storage 
§Safety
frommust be the position ofoutwithin the archivetomust be the position of some validTvaluemust be the value being serializedmetadata_resolvermust be the result of serializing the metadata ofvalue
Sourcepub unsafe fn try_resolve_emplace_from_raw_parts(
    from: usize,
    to: usize,
    archived_metadata: <T as ArchivePointee>::ArchivedMetadata,
    out: *mut Self,
) -> Result<(), OffsetError>
 
pub unsafe fn try_resolve_emplace_from_raw_parts( from: usize, to: usize, archived_metadata: <T as ArchivePointee>::ArchivedMetadata, out: *mut Self, ) -> Result<(), OffsetError>
Attempts to create a relative pointer from one position to another given raw pointer metadata.
This does the same thing as RelPtr::try_resolve_emplace but you must supply
the <T as ArchivePointee>::ArchivedMetadata
yourself directly rather than through an implementation of ArchiveUnsized on some
value.
§Safety
frommust be the position ofoutwithin the archivetomust be the position of some validTvaluemust be the value being serializedarchived_metadatamust produce valid metadata for the pointee of the resultingRelPtr(the thing being pointed at) when<T as ArchivePointee>::pointer_metadata(archived_metadata)is called.
Sourcepub unsafe fn resolve_emplace_from_raw_parts(
    from: usize,
    to: usize,
    archived_metadata: <T as ArchivePointee>::ArchivedMetadata,
    out: *mut Self,
)
 
pub unsafe fn resolve_emplace_from_raw_parts( from: usize, to: usize, archived_metadata: <T as ArchivePointee>::ArchivedMetadata, out: *mut Self, )
Creates a relative pointer from one position to another given raw pointer metadata.
This does the same thing as RelPtr::resolve_emplace but you must supply
the <T as ArchivePointee>::ArchivedMetadata
yourself directly rather than through an implementation of ArchiveUnsized on some
value.
§Panics
- The offset between 
fromandtodoes not fit in anisize - The offset between 
fromandtoexceeds the offset storage 
§Safety
frommust be the position ofoutwithin the archivetomust be the position of some validTvaluemust be the value being serializedarchived_metadatamust produce valid metadata for the pointee of the resultingRelPtr(the thing being pointed at) when<T as ArchivePointee>::pointer_metadata(archived_metadata)is called.
Sourcepub fn metadata(&self) -> &T::ArchivedMetadata
 
pub fn metadata(&self) -> &T::ArchivedMetadata
Gets the metadata of the relative pointer.
Sourcepub fn as_ptr(&self) -> *const T
 
pub fn as_ptr(&self) -> *const T
Calculates the memory address being pointed to by this relative pointer.
Sourcepub fn as_mut_ptr(&mut self) -> *mut T
 
pub fn as_mut_ptr(&mut self) -> *mut T
Returns an unsafe mutable pointer to the memory address being pointed to by this relative pointer.