pub struct SharedRegion { /* private fields */ }Expand description
The host’s side of a region, mapped read-write: a sealed memfd on Linux, a POSIX shared
memory object unlinked at once on macOS, an unnamed section on Windows.
Implementations§
Sourcepub fn create(len: usize) -> Result<Self>
pub fn create(len: usize) -> Result<Self>
Makes a region of len bytes, zeroed.
§Errors
When len is zero or the operating system refuses the memory, and on platforms without
shared regions (Unsupported).
Sourcepub const fn is_empty(&self) -> bool
pub const fn is_empty(&self) -> bool
Whether the region holds no bytes, which Self::create refuses.
Sourcepub const fn as_mut_slice(&mut self) -> &mut [u8] ⓘ
pub const fn as_mut_slice(&mut self) -> &mut [u8] ⓘ
The region’s bytes.
Sourcepub fn descriptor(&self) -> BorrowedFd<'_>
pub fn descriptor(&self) -> BorrowedFd<'_>
The descriptor to send a worker, which maps it with MappedRegion::open. It cannot
resize the region or map it writable, except on Linux before 5.1 (no
F_SEAL_FUTURE_WRITE), where only the worker’s read-only mapping keeps it from writing.
Trait Implementations§
Auto Trait Implementations§
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