pub struct RelativePtr<T> { /* private fields */ }Expand description
A Relative Pointer to the block memory address, relative to the start of the matrix inside the process memory scope.
This RelativePointer is used to calculate the accurate address of the block its related to. Providing a way for independent process to localize the data inside their own mappings of the SHM segment.
It also receives a PhantomData to inform the compiler we safely own whatever generic type the caller has passed to this pointer.
Implementations§
Source§impl<T> RelativePtr<T>
impl<T> RelativePtr<T>
Sourcepub unsafe fn resolve_header<'a>(&self, base_ptr: *const u8) -> &'a BlockHeader
pub unsafe fn resolve_header<'a>(&self, base_ptr: *const u8) -> &'a BlockHeader
Resolves the header based on the base_ptr of the current caller process.
This ensures that the pointer returned is actually mapped to the process local memory scope
§Params:
@base_ptr: The offset from the start of the SHM segment.
§Returns:
A life time speficied reference to the header of this block
pub unsafe fn resolve_header_mut<'a>( &self, base_ptr: *const u8, ) -> &'a mut BlockHeader
Sourcepub unsafe fn resolve_mut<'a>(&self, base_ptr: *const u8) -> &'a mut T
pub unsafe fn resolve_mut<'a>(&self, base_ptr: *const u8) -> &'a mut T
Resolves the block scope based on the base_ptr of the current caller process.
This ensures that the pointer returned is actually mapped to the process local memory scope
§Params:
@base_ptr: The offset from the start of the SHM segment.
§Returns:
A life time specified mutable reference to the block scope.