pub struct ShmFile { /* private fields */ }Expand description
Cross-platform RAM-resident named shared-memory backing.
Two handles created with the same logical name map onto the same
underlying memory region. This is the cross-process visibility
property that makes this distinct from MmapOptions::map_anon.
Implementations§
Source§impl ShmFile
impl ShmFile
Sourcepub fn create_or_open_named(logical_name: &str, size: usize) -> Result<Self>
pub fn create_or_open_named(logical_name: &str, size: usize) -> Result<Self>
Create or open a named RAM-resident shared-memory region of
size bytes. Two handles created with the same logical name
map onto the same underlying memory.
Sourcepub fn as_mut_slice(&mut self) -> &mut [u8] ⓘ
pub fn as_mut_slice(&mut self) -> &mut [u8] ⓘ
Mutable byte slice into the mapped region. Length equals the
size passed at creation time. Cross-platform.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
True if the mapped region is zero bytes (never possible since
create_or_open_named asserts size > 0; method exists for
clippy’s len_without_is_empty).
Sourcepub fn logical_name(&self) -> &str
pub fn logical_name(&self) -> &str
Logical name (without the platform prefix).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ShmFile
impl RefUnwindSafe for ShmFile
impl Unpin for ShmFile
impl UnsafeUnpin for ShmFile
impl UnwindSafe for ShmFile
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more