Struct shared_memory::SharedMemConf
source · pub struct SharedMemConf<'a> { /* private fields */ }
Expand description
Configuration used to describe a shared memory mapping before openning/creation
Implementations§
sourcepub fn new() -> SharedMemConf<'a>
pub fn new() -> SharedMemConf<'a>
Returns a new SharedMemConf
sourcepub fn set_size(self, wanted_size: usize) -> SharedMemConf<'a>
pub fn set_size(self, wanted_size: usize) -> SharedMemConf<'a>
Sets the size of the usable memory in the mapping
sourcepub fn set_link_path(self, link_path: &OsStr) -> SharedMemConf<'a>
pub fn set_link_path(self, link_path: &OsStr) -> SharedMemConf<'a>
Sets the path for the link file
sourcepub fn set_os_path(self, unique_id: &str) -> SharedMemConf<'a>
pub fn set_os_path(self, unique_id: &str) -> SharedMemConf<'a>
Sets a specific unique_id to be used when creating the mapping
sourcepub fn add_lock(
self,
lock_type: LockType,
offset: usize,
length: usize
) -> Result<SharedMemConf<'a>, Box<dyn Error>>
pub fn add_lock(
self,
lock_type: LockType,
offset: usize,
length: usize
) -> Result<SharedMemConf<'a>, Box<dyn Error>>
Adds a lock of specified type on a range of bytes
sourcepub fn add_event(
self,
event_type: EventType
) -> Result<SharedMemConf<'a>, Box<dyn Error>>
pub fn add_event(
self,
event_type: EventType
) -> Result<SharedMemConf<'a>, Box<dyn Error>>
Adds an event of specified type
sourcepub fn create(self) -> Result<SharedMem<'a>, Box<dyn Error>>
pub fn create(self) -> Result<SharedMem<'a>, Box<dyn Error>>
Creates a shared memory mapping from the current config values
sourcepub fn open(self) -> Result<SharedMem<'a>, Box<dyn Error>>
pub fn open(self) -> Result<SharedMem<'a>, Box<dyn Error>>
Opens a shared memory mapping.
This will look at the current link_path/os_path to create the SharedMem. Other values will be reset.
sourcepub fn get_link_path(&self) -> Option<&Path>
pub fn get_link_path(&self) -> Option<&Path>
Returns the currently set link_path value
sourcepub fn get_os_path(&self) -> Option<&str>
pub fn get_os_path(&self) -> Option<&str>
Returns the currently set os_path value
sourcepub fn get_metadata_size(&self) -> usize
pub fn get_metadata_size(&self) -> usize
Returns the current size that the metadata will take
sourcepub fn num_events(&self) -> usize
pub fn num_events(&self) -> usize
Returns the current number of events