#[repr(C)]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<E: Error>(
from: usize,
to: usize,
out: *mut Self
) -> Result<(), E>
pub unsafe fn try_emplace<E: Error>( from: usize, to: usize, out: *mut Self ) -> Result<(), E>
Attempts to create a relative pointer from one position to another.
§Safety
out
must point to a Self
that is valid for reads and writes.
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,
source§impl<T: ArchivePointee + ?Sized, O: Offset> RelPtr<T, O>
impl<T: ArchivePointee + ?Sized, O: Offset> RelPtr<T, O>
sourcepub unsafe fn try_emplace_unsized<E: Error>(
from: usize,
to: usize,
metadata: T::ArchivedMetadata,
out: *mut Self
) -> Result<(), E>
pub unsafe fn try_emplace_unsized<E: Error>( from: usize, to: usize, metadata: T::ArchivedMetadata, out: *mut Self ) -> Result<(), E>
Attempts to create a relative pointer from one position to another.
§Safety
out
must point to a Self
that is valid for reads and writes.
sourcepub unsafe fn emplace_unsized(
from: usize,
to: usize,
metadata: T::ArchivedMetadata,
out: *mut Self
)
pub unsafe fn emplace_unsized( from: usize, to: usize, metadata: T::ArchivedMetadata, out: *mut Self )
sourcepub fn metadata(&self) -> &T::ArchivedMetadata
pub fn metadata(&self) -> &T::ArchivedMetadata
Gets the metadata of the relative pointer.
sourcepub unsafe fn as_ptr(&self) -> *mut T
pub unsafe fn as_ptr(&self) -> *mut T
Calculates the memory address being pointed to by this relative pointer.
§Safety
The offset of this relative pointer, when added to its base, must be located in the same allocated object as it.
sourcepub fn as_ptr_wrapping(&self) -> *mut T
pub fn as_ptr_wrapping(&self) -> *mut T
Calculates the memory address being pointed to by this relative pointer using wrapping methods.
This method is a safer but potentially slower version of as_ptr
.
Trait Implementations§
source§impl<T: ArchivePointee + ?Sized, O, __C: Fallible + ?Sized> CheckBytes<__C> for RelPtr<T, O>where
<__C as Fallible>::Error: Trace,
RawRelPtr<O>: CheckBytes<__C>,
T::ArchivedMetadata: CheckBytes<__C>,
PhantomData<T>: CheckBytes<__C>,
impl<T: ArchivePointee + ?Sized, O, __C: Fallible + ?Sized> CheckBytes<__C> for RelPtr<T, O>where
<__C as Fallible>::Error: Trace,
RawRelPtr<O>: CheckBytes<__C>,
T::ArchivedMetadata: CheckBytes<__C>,
PhantomData<T>: CheckBytes<__C>,
source§unsafe fn check_bytes(
value: *const Self,
context: &mut __C
) -> Result<(), <__C as Fallible>::Error>
unsafe fn check_bytes( value: *const Self, context: &mut __C ) -> Result<(), <__C as Fallible>::Error>
Checks whether the given pointer points to a valid value within the
given context. Read more
source§impl<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,
impl<T, O> Portable for RelPtr<T, O>where
T: ArchivePointee + Portable + ?Sized,
RawRelPtr<O>: Portable,
T::ArchivedMetadata: Portable,
PhantomData<T>: Portable,
Auto Trait Implementations§
impl<T: ?Sized, O> Freeze for RelPtr<T, O>
impl<T: ?Sized, O> RefUnwindSafe for RelPtr<T, O>
impl<T: ?Sized, O> Send for RelPtr<T, O>
impl<T: ?Sized, O> Sync for RelPtr<T, O>
impl<T, O> !Unpin for RelPtr<T, O>
impl<T: ?Sized, O> UnwindSafe for RelPtr<T, O>
Blanket Implementations§
source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Gets the layout of the type.