pub enum RegionPolicy {
Immutable,
AppendOnly {
max_size: usize,
},
Slab {
slot_size: usize,
slot_count: usize,
},
}Expand description
Memory region access policy.
RuVix does not implement demand paging. All regions are physically backed
at region_map time. This eliminates page faults, swap, and copy-on-write
complexity.
Variants§
Immutable
Contents are set once at creation and never modified.
The kernel may deduplicate identical immutable regions. Ideal for: RVF component code, trained model weights, lookup tables.
AppendOnly
Contents can only be appended, never overwritten or truncated.
A monotonic write cursor tracks the append position. Ideal for: witness logs, event streams, time-series vectors.
Slab
Fixed-size slots allocated from a free list.
Slots can be freed and reused. No fragmentation by construction. Ideal for: task control blocks, capability tables, queue ring buffers.
Implementations§
Source§impl RegionPolicy
impl RegionPolicy
Sourcepub const fn is_writable(&self) -> bool
pub const fn is_writable(&self) -> bool
Returns true if this policy allows writes.
Sourcepub const fn allows_overwrite(&self) -> bool
pub const fn allows_overwrite(&self) -> bool
Returns true if this policy allows in-place modifications.
Only Slab regions allow overwriting existing data. AppendOnly regions only permit appending.
Sourcepub const fn append_only(max_size: usize) -> Self
pub const fn append_only(max_size: usize) -> Self
Creates an append-only region policy.
Trait Implementations§
Source§impl Clone for RegionPolicy
impl Clone for RegionPolicy
Source§fn clone(&self) -> RegionPolicy
fn clone(&self) -> RegionPolicy
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more