pub trait ShMem: Sized + Debug + Clone + AsSlice<u8> + AsMutSlice<u8> {
fn id(&self) -> ShMemId;
fn len(&self) -> usize;
fn is_empty(&self) -> bool { ... }
unsafe fn as_object<T: Sized + 'static>(&self) -> &T { ... }
unsafe fn as_object_mut<T: Sized + 'static>(&mut self) -> &mut T { ... }
fn description(&self) -> ShMemDescription { ... }
fn write_to_env(&self, env_name: &str) -> Result<(), Error> { ... }
}
Expand description
A ShMem
is an interface to shared maps.
They are the backbone of crate::bolts::llmp
for inter-process communication.
All you need for scaling on a new target is to implement this interface, as well as the respective ShMemProvider
.
Required Methods
Provided Methods
Convert to an owned object reference
Safety
This function is not safe as the object may be not initialized.
The user is responsible to initialize the object with something like
*shmem.as_object_mut::<T>() = T::new();
unsafe fn as_object_mut<T: Sized + 'static>(&mut self) -> &mut T
unsafe fn as_object_mut<T: Sized + 'static>(&mut self) -> &mut T
Convert to an owned object mutable reference
Safety
This function is not safe as the object may be not initialized.
The user is responsible to initialize the object with something like
*shmem.as_object_mut::<T>() = T::new();
fn description(&self) -> ShMemDescription
fn description(&self) -> ShMemDescription
Get the description of the shared memory mapping