pub struct LlmpSharedMap<SHM>
where SHM: ShMem,
{ /* private fields */ }
Expand description

A page wrapper

Implementations§

source§

impl<SHM> LlmpSharedMap<SHM>
where SHM: ShMem,

The page struct, placed on a shared mem instance. A thin wrapper around a ShMem implementation, with special crate::llmp funcs

source

pub fn new(sender: ClientId, new_shmem: SHM) -> Self

Creates a new page, initializing the passed shared mem struct

source

pub fn existing(existing_shmem: SHM) -> Self

Maps and wraps an existing

source

pub fn mark_safe_to_unmap(&mut self)

Marks the containing page as safe_to_unmap. This indicates, that the page may safely be unmapped by the sender.

source

pub unsafe fn page_mut(&mut self) -> *mut LlmpPage

Get the unsafe ptr to this page, situated on the shared map

Safety

The unsafe page pointer is obviously unsafe.

source

pub unsafe fn page(&self) -> *const LlmpPage

Get the unsafe ptr to this page, situated on the shared map

Safety

The unsafe page pointer is obviously unsafe.

source

pub unsafe fn msg_to_offset(&self, msg: *const LlmpMsg) -> Result<u64, Error>

Gets the offset of a message on this here page. Will return crate::Error::illegal_argument error if msg is not on page.

Safety

This dereferences msg, make sure to pass a proper pointer to it.

source

pub fn msg_from_env( &mut self, map_env_name: &str ) -> Result<*mut LlmpMsg, Error>

Retrieve the stored msg from env_name + _OFFSET. It will restore the stored offset by env_name and return the message.

source

pub unsafe fn msg_to_env( &self, msg: *const LlmpMsg, map_env_name: &str ) -> Result<(), Error>

Store this msg offset to env_name + _OFFSET env variable. It can be restored using LlmpSharedMap::msg_from_env() with the same env_name later.

Safety

This function will dereference the msg ptr, make sure it’s valid.

source

pub fn msg_from_offset(&mut self, offset: u64) -> Result<*mut LlmpMsg, Error>

Gets this message from this page, at the indicated offset. Will return crate::Error::illegal_argument error if the offset is out of bounds.

Trait Implementations§

source§

impl<SHM> Clone for LlmpSharedMap<SHM>
where SHM: ShMem + Clone,

source§

fn clone(&self) -> LlmpSharedMap<SHM>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<SHM> Debug for LlmpSharedMap<SHM>
where SHM: ShMem + Debug,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<SHM> RefUnwindSafe for LlmpSharedMap<SHM>
where SHM: RefUnwindSafe,

§

impl<SHM> Send for LlmpSharedMap<SHM>
where SHM: Send,

§

impl<SHM> Sync for LlmpSharedMap<SHM>
where SHM: Sync,

§

impl<SHM> Unpin for LlmpSharedMap<SHM>
where SHM: Unpin,

§

impl<SHM> UnwindSafe for LlmpSharedMap<SHM>
where SHM: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<Tail, T> Prepend<T> for Tail

§

type PreprendResult = Tail

The Resulting TupleList, of an Prepend::prepend() call, including the prepended entry.
source§

fn prepend(self, value: T) -> (T, <Tail as Prepend<T>>::PreprendResult)

Prepend a value to this tuple, returning a new tuple with prepended value.
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> Ungil for T
where T: Send,