pub struct RelPtr<T: ArchivePointee + ?Sized, O> { /* private fields */ }
Expand description
Implementations
sourceimpl<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
from
must be the position ofout
within the archiveto
must be the position of some validT
sourceimpl<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.
sourceimpl<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
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
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
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
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.
Trait Implementations
sourceimpl<T: ArchivePointee + ?Sized, O: Debug> Debug for RelPtr<T, O> where
T::ArchivedMetadata: Debug,
impl<T: ArchivePointee + ?Sized, O: Debug> Debug for RelPtr<T, O> where
T::ArchivedMetadata: Debug,
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, O> !Unpin for RelPtr<T, O>
impl<T: ?Sized, O> UnwindSafe for RelPtr<T, O> where
O: UnwindSafe,
T: UnwindSafe,
<T as ArchivePointee>::ArchivedMetadata: UnwindSafe,
Blanket Implementations
sourceimpl<T> ArchivePointee for T
impl<T> ArchivePointee for T
type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
sourcefn pointer_metadata(_: &Self::ArchivedMetadata) -> <Self as Pointee>::Metadata
fn pointer_metadata(_: &Self::ArchivedMetadata) -> <Self as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more