pub struct Segment { /* private fields */ }Expand description
A segment of OS memory.
Implementations§
Source§impl Segment
impl Segment
Sourcepub fn new(
base: Option<*mut u8>,
size: usize,
page_size: usize,
flags: ProtFlags,
) -> Result<Self, Error>
pub fn new( base: Option<*mut u8>, size: usize, page_size: usize, flags: ProtFlags, ) -> Result<Self, Error>
Create a segment of OS memory.
When base is None, new memory will be allocated. Otherwise, the given pointer will be
used, and Segment will not assume ownership of the underlying memory segment. page_size
must be a power of 2.
Patch a SharedMemory to a part of this memory segment. The given shm will start with an
offset from the beginning of Segment, and cannot overrun the end of the segment. The
given SharedMemory outlives this object once patched (even if it is over-shadowed by
subsequent patching).
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Segment
impl !RefUnwindSafe for Segment
impl Send for Segment
impl Sync for Segment
impl Unpin for Segment
impl UnwindSafe for Segment
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