pub struct PageOffset(pub usize);Tuple Fields§
§0: usizeImplementations§
Source§impl PageOffset
impl PageOffset
Sourcepub fn calculate_page_offset(
file_number: usize,
offset_in_file: usize,
) -> PageOffset
pub fn calculate_page_offset( file_number: usize, offset_in_file: usize, ) -> PageOffset
This will calculate a page offset based on the max file count and the offset from the first non-zero page in a file.
Example: found file blah_blah.1 and in that file found a single non-zero page. We will return a page offset of 2 * PAGES_PER_FILE + 1
Sourcepub fn get_file_chunk_size(&self) -> usize
pub fn get_file_chunk_size(&self) -> usize
Gets the needed size for this offset to support resize operations
Sourcepub fn get_file_number(&self) -> usize
pub fn get_file_number(&self) -> usize
Gets the file number for use in opening the file chunk
Sourcepub fn get_file_seek(&self) -> usize
pub fn get_file_seek(&self) -> usize
Gets the location to seek to in order to write to the block the page offset points at
Sourcepub fn get_bitmask_offset(&self) -> (PageOffset, usize)
pub fn get_bitmask_offset(&self) -> (PageOffset, usize)
Gets the position of the free/visibility mask for an offset
let page = PageOffset(100);
assert_eq!(page.get_bitmask_offset(), (PageOffset(0), 100));Sourcepub fn is_same_file(&self, rhs: &PageOffset) -> bool
pub fn is_same_file(&self, rhs: &PageOffset) -> bool
Determines if a given offset will be the same file or not
Sourcepub fn next(&self) -> PageOffset
pub fn next(&self) -> PageOffset
Gets the next offset in sequence
Trait Implementations§
Source§impl Add for PageOffset
impl Add for PageOffset
Source§impl AddAssign for PageOffset
impl AddAssign for PageOffset
Source§fn add_assign(&mut self, other: Self)
fn add_assign(&mut self, other: Self)
Performs the
+= operation. Read moreSource§impl Clone for PageOffset
impl Clone for PageOffset
Source§fn clone(&self) -> PageOffset
fn clone(&self) -> PageOffset
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl ConstEncodedSize for PageOffset
impl ConstEncodedSize for PageOffset
fn encoded_size() -> usize
Source§impl Debug for PageOffset
impl Debug for PageOffset
Source§impl Display for PageOffset
impl Display for PageOffset
Source§impl Hash for PageOffset
impl Hash for PageOffset
Source§impl Mul for PageOffset
impl Mul for PageOffset
Source§impl Ord for PageOffset
impl Ord for PageOffset
Source§fn cmp(&self, other: &PageOffset) -> Ordering
fn cmp(&self, other: &PageOffset) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for PageOffset
impl PartialEq for PageOffset
Source§impl PartialOrd for PageOffset
impl PartialOrd for PageOffset
impl Copy for PageOffset
impl Eq for PageOffset
impl StructuralPartialEq for PageOffset
Auto Trait Implementations§
impl Freeze for PageOffset
impl RefUnwindSafe for PageOffset
impl Send for PageOffset
impl Sync for PageOffset
impl Unpin for PageOffset
impl UnwindSafe for PageOffset
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