This library provides a interface to create database pages.
A page is a fixed size buffer that can be used to store data.
Example
In your cargo.toml:
[]
= "2"
use ;
use Pages;
let file = options
.read
.write
.create
.open.unwrap;
// First generic argument is the page number type. Number of page that can be stored in the file.
// Second generic argument is the size of the page.
let pages: = open.unwrap;
// Create a page.
pages.create.unwrap;
// Overwrite a page.
pages.write.unwrap;
// Read a page.
assert_eq!;
assert_eq!;
// Alloc 2 more pages
pages.alloc.unwrap;
assert_eq!;
remove_file;
See /tests folder for more examples.