Struct swap::file::FilePageState
source · struct FilePageState(u32);
Expand description
u32 to pack the state of a page on the file.
- MSB: Whether the page on file is freed. (1: freed, 2: allocated)
- lower 31 bits:
- The corresponding page index if the file page is allocated.
- The file page index + 1 of next freed file page if the file page is freed. Zero means it is the last page in the free list.
Tuple Fields§
§0: u32
Implementations§
source§impl FilePageState
impl FilePageState
const FREED_BIT_MASK: u32 = 2_147_483_648u32
fn freed_state(first_freed_page: Option<usize>) -> Self
fn allocated_state(idx_page: usize) -> Option<Self>
fn is_freed(&self) -> bool
sourcefn next_file_freed_idx(&self) -> Option<Option<usize>>
fn next_file_freed_idx(&self) -> Option<Option<usize>>
This is valid only if the page is freed.
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for FilePageState
impl Send for FilePageState
impl Sync for FilePageState
impl Unpin for FilePageState
impl UnwindSafe for FilePageState
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