pub struct FrameRegion { /* private fields */ }Expand description
Concurrent fixed-block region. Multi-producer alloc,
multi-consumer free, any-order reclaim.
Implementations§
Source§impl FrameRegion
impl FrameRegion
Sourcepub fn create_anon(
block_size: usize,
block_count: usize,
) -> Result<Self, RingError>
pub fn create_anon( block_size: usize, block_count: usize, ) -> Result<Self, RingError>
Anonymous in-process region.
Sourcepub fn create(
path: impl AsRef<Path>,
block_size: usize,
block_count: usize,
) -> Result<Self, RingError>
pub fn create( path: impl AsRef<Path>, block_size: usize, block_count: usize, ) -> Result<Self, RingError>
File-backed region; cross-process via the page cache.
Sourcepub fn open(
path: impl AsRef<Path>,
block_size: usize,
block_count: usize,
) -> Result<Self, RingError>
pub fn open( path: impl AsRef<Path>, block_size: usize, block_count: usize, ) -> Result<Self, RingError>
Open an existing file-backed region. Validates the header.
Sourcepub fn create_from_shm(
shm: ShmFile,
block_size: usize,
block_count: usize,
) -> Result<Self, RingError>
pub fn create_from_shm( shm: ShmFile, block_size: usize, block_count: usize, ) -> Result<Self, RingError>
Build a region on a named RAM-resident shared-memory backing.
Sourcepub fn open_from_shm(
shm: ShmFile,
block_size: usize,
block_count: usize,
) -> Result<Self, RingError>
pub fn open_from_shm( shm: ShmFile, block_size: usize, block_count: usize, ) -> Result<Self, RingError>
Open an existing named ShmFs-backed region (no re-init).
Sourcepub fn block_size(&self) -> usize
pub fn block_size(&self) -> usize
Largest payload a block holds.
Sourcepub fn block_count(&self) -> usize
pub fn block_count(&self) -> usize
Number of blocks.
Sourcepub fn alloc(&self) -> Option<u32>
pub fn alloc(&self) -> Option<u32>
Allocate a block. Free list first, then bump. None when full.
Sourcepub fn write_block(&self, idx: u32, payload: &[u8])
pub fn write_block(&self, idx: u32, payload: &[u8])
Copy payload into block idx. Caller guarantees
payload.len() <= block_size.
Trait Implementations§
impl Send for FrameRegion
impl Sync for FrameRegion
Auto Trait Implementations§
impl Freeze for FrameRegion
impl RefUnwindSafe for FrameRegion
impl Unpin for FrameRegion
impl UnsafeUnpin for FrameRegion
impl UnwindSafe for FrameRegion
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