Struct memory_pager::Pager
[−]
[src]
pub struct Pager { pub page_size: usize, pub pages: Vec<Option<Page>>, // some fields omitted }
Memory pager instance. Manages Page
instances.
Fields
page_size: usize
The size of each page held in memory.
pages: Vec<Option<Page>>
A vector of pages that are held in memory.
Methods
impl Pager
[src]
pub fn new(page_size: usize) -> Self
[src]
pub fn with_pages(page_size: usize, pages: Vec<Option<Page>>) -> Self
[src]
Create a new Pager
instance with a page_size
and pages
. Useful
to restore a Pager
instance from disk.
pub fn get_mut_or_alloc(&mut self, page_num: usize) -> &mut Page
[src]
Get a Page
mutably. The page will be allocated on first access.
pub fn get(&mut self, page_num: usize) -> Option<&Page>
[src]
Get a Page
wrapped in an Option
enum. Does not allocate on access.
pub fn get_mut(&mut self, page_num: usize) -> Option<&mut Page>
[src]
Get a mutable Page
wrapped in an Option
enum. Does not allocate on
access.
pub fn len(&self) -> usize
[src]
Return the highest index number for the Pages held. Not exactly the "length" in the classical sence, but the same for all intents and purposes.
pub fn is_empty(&self) -> bool
[src]
check whether the length
is zero.
Trait Implementations
impl Debug for Pager
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more