Struct shared_memory::SharedMem
source · pub struct SharedMem<'a> { /* private fields */ }
Expand description
Default shared mapping structure
Implementations§
sourcepub fn create(
lock_type: LockType,
size: usize
) -> Result<SharedMem<'a>, Box<dyn Error>>
pub fn create(
lock_type: LockType,
size: usize
) -> Result<SharedMem<'a>, Box<dyn Error>>
Creates a memory mapping with no link file of specified size controlled by a single lock.
pub fn open(unique_id: &str) -> Result<SharedMem<'a>, Box<dyn Error>>
pub fn create_linked(
new_link_path: &OsStr,
lock_type: LockType,
size: usize
) -> Result<SharedMem<'a>, Box<dyn Error>>
pub fn open_linked(
existing_link_path: &OsStr
) -> Result<SharedMem<'a>, Box<dyn Error>>
pub fn get_metadata_size(&self) -> usize
pub fn num_locks(&self) -> usize
pub fn num_events(&self) -> usize
sourcepub fn get_link_path(&self) -> Option<&Path>
pub fn get_link_path(&self) -> Option<&Path>
Returns the link_path of the SharedMem
sourcepub fn get_os_path(&self) -> &str
pub fn get_os_path(&self) -> &str
Returns the OS specific path of the shared memory object
Usualy on Linux, this will point to a file under /dev/shm/
On Windows, this returns a namespace
pub fn get_ptr(&self) -> *mut c_void
Trait Implementations§
source§fn rlock<D: SharedMemCast>(
&self,
lock_index: usize
) -> Result<ReadLockGuard<'_, D>, Box<dyn Error>>
fn rlock<D: SharedMemCast>(
&self,
lock_index: usize
) -> Result<ReadLockGuard<'_, D>, Box<dyn Error>>
Returns a read lock to the shared memory Read more
source§fn rlock_as_slice<D: SharedMemCast>(
&self,
lock_index: usize
) -> Result<ReadLockGuardSlice<'_, D>, Box<dyn Error>>
fn rlock_as_slice<D: SharedMemCast>(
&self,
lock_index: usize
) -> Result<ReadLockGuardSlice<'_, D>, Box<dyn Error>>
Returns a read lock to the shared memory as a slice Read more
unsafe fn get_raw<D: SharedMemCast>(&self) -> &D
unsafe fn get_raw_slice<D: SharedMemCast>(&self) -> &[D] ⓘ
source§fn wlock<D: SharedMemCast>(
&mut self,
lock_index: usize
) -> Result<WriteLockGuard<'_, D>, Box<dyn Error>>
fn wlock<D: SharedMemCast>(
&mut self,
lock_index: usize
) -> Result<WriteLockGuard<'_, D>, Box<dyn Error>>
Returns a read/write lock to the shared memory Read more
source§fn wlock_as_slice<D: SharedMemCast>(
&mut self,
lock_index: usize
) -> Result<WriteLockGuardSlice<'_, D>, Box<dyn Error>>
fn wlock_as_slice<D: SharedMemCast>(
&mut self,
lock_index: usize
) -> Result<WriteLockGuardSlice<'_, D>, Box<dyn Error>>
Returns a read/write access to a &mut [T] on the shared memory Read more