pub trait RegionOwner:
Send
+ Sync
+ 'static {
// Required methods
fn region_ptr(&mut self) -> *mut u8;
fn region_len(&self) -> usize;
}Expand description
Caller-owned memory a ring can be laid out in: huge / large pages,
or any region. The ring takes ownership (keeping it mapped) and
writes its header + slots into the region’s bytes. Implemented for
HugepageRegion (Linux), LargePageRegion / LargePageSection
(Windows) - so a ring can sit on 2 MB / 1 GB pages and shed the TLB
pressure of thousands of 4 KB pages, which matters once you have
many rings or one very large one.
The ring header is align(64), so the region base must be
64-byte aligned. Page-backed regions (huge / large pages, mmap)
satisfy this by construction; a hand-rolled region must align its
buffer or the constructor returns
RingError::LayoutMismatch.
Required Methods§
Sourcefn region_ptr(&mut self) -> *mut u8
fn region_ptr(&mut self) -> *mut u8
Pointer to the start of the region (must be 64-byte aligned).
Sourcefn region_len(&self) -> usize
fn region_len(&self) -> usize
Region length in bytes (must be >= the ring’s file size).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".