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

Get the id of this shared memory mapping

Get the size of this mapping

Provided Methods

Check if the mapping is empty

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();

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();

Get the description of the shared memory mapping

Write this map’s config to env

Implementors