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>
Source§impl<T: ArchivePointee + ?Sized, O: Offset> RelPtr<T, O>
impl<T: ArchivePointee + ?Sized, O: Offset> RelPtr<T, O>
Sourcepub fn try_emplace_invalid<E: Source>(out: Place<Self>) -> Result<(), E>
pub fn try_emplace_invalid<E: Source>(out: Place<Self>) -> Result<(), E>
Attempts to create an invalid relative pointer with default metadata.
Sourcepub fn emplace_invalid(out: Place<Self>)
pub fn emplace_invalid(out: Place<Self>)
Creates an invalid relative pointer with default metadata.
§Panics
- If an offset of
1does not fit in anisize - If an offset of
1exceeds the offset storage
Sourcepub fn try_emplace_unsized<E: Source>(
to: usize,
metadata: T::ArchivedMetadata,
out: Place<Self>,
) -> Result<(), E>
pub fn try_emplace_unsized<E: Source>( to: usize, metadata: T::ArchivedMetadata, out: Place<Self>, ) -> Result<(), E>
Attempts to create a relative pointer from one position to another.
Sourcepub fn emplace_unsized(
to: usize,
metadata: T::ArchivedMetadata,
out: Place<Self>,
)
pub fn emplace_unsized( to: usize, metadata: T::ArchivedMetadata, out: Place<Self>, )
Creates a relative pointer from one position to another.
§Panics
- If the offset between
fromandtodoes not fit in anisize - If the offset between
fromandtoexceeds the offset storage
Sourcepub fn base_raw(this: *mut Self) -> *mut u8
pub fn base_raw(this: *mut Self) -> *mut u8
Gets the base pointer for the pointed-to relative pointer.
Sourcepub unsafe fn offset_raw(this: *mut Self) -> isize
pub unsafe fn offset_raw(this: *mut Self) -> isize
Gets the offset of the pointed-to relative pointer from its base.
§Safety
this must be non-null, properly-aligned, and point to a valid
RelPtr.
Sourcepub unsafe fn as_ptr_raw(this: *mut Self) -> *mut T
pub unsafe fn as_ptr_raw(this: *mut Self) -> *mut T
Calculates the memory address being pointed to by the pointed-to relative pointer.
§Safety
thismust be non-null, properly-aligned, and point to a validRelPtr.- The offset of this relative pointer, when added to its base, must be located in the same allocated object as it.
Sourcepub unsafe fn as_ptr_wrapping_raw(this: *mut Self) -> *mut T
pub unsafe fn as_ptr_wrapping_raw(this: *mut Self) -> *mut T
Calculates the memory address being pointed to by the pointed-to relative pointer using wrapping methods.
This method is a safer but potentially slower version of as_ptr_raw.
§Safety
this must be non-null, properly-aligned, and point to a valid
RelPtr.
Sourcepub unsafe fn is_invalid_raw(this: *mut Self) -> bool
pub unsafe fn is_invalid_raw(this: *mut Self) -> bool
Gets whether the offset of the pointed-to relative pointer is invalid.
§Safety
this must be non-null, properly-aligned, and point to a valid
RawRelPtr.
Sourcepub fn base_mut(this: Seal<'_, Self>) -> *mut u8
pub fn base_mut(this: Seal<'_, Self>) -> *mut u8
Gets the mutable base pointer for this relative pointer.
Sourcepub fn is_invalid(&self) -> bool
pub fn is_invalid(&self) -> bool
Gets whether the offset of the relative pointer is 0.
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) -> *const T
pub unsafe fn as_ptr(&self) -> *const 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 unsafe fn as_mut_ptr(this: Seal<'_, Self>) -> *mut T
pub unsafe fn as_mut_ptr(this: Seal<'_, Self>) -> *mut T
Calculates the mutable 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) -> *const T
pub fn as_ptr_wrapping(&self) -> *const 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.
Sourcepub fn as_mut_ptr_wrapping(this: Seal<'_, Self>) -> *mut T
pub fn as_mut_ptr_wrapping(this: Seal<'_, Self>) -> *mut T
Calculates the mutable 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§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: ArchivePointee + ?Sized, O> Portable for RelPtr<T, O>
Auto Trait Implementations§
impl<T, O> Freeze for RelPtr<T, O>
impl<T, O> RefUnwindSafe for RelPtr<T, O>where
<T as ArchivePointee>::ArchivedMetadata: RefUnwindSafe,
O: RefUnwindSafe,
T: RefUnwindSafe + ?Sized,
impl<T, O> Send for RelPtr<T, O>
impl<T, O> Sync for RelPtr<T, O>
impl<T, O> !Unpin for RelPtr<T, O>
impl<T, O> !UnsafeUnpin for RelPtr<T, O>
impl<T, O> UnwindSafe for RelPtr<T, O>
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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
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>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.