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:
[dependencies]
flex-page = "0.6"
use File;
use Pages;
let file = options
.read
.write
.create
.open?;
// 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?;
// Create a page.
pages.create.await?;
// Overwrite a page.
pages.write.await?;
// Reading a page and write to it.
// It also lock the page num. So, this page can't be read by other thread.
let mut page = pages.goto.await?;
assert_eq!;
// Write to the page.
// It drops the lock. So, this page can be accessable by other thread.
page.write_buf.await?;
// Read a page.
assert_eq!;
See /tests folder for more examples.