Added Position type for cursor
This commit is contained in:
parent
53870fecce
commit
b4a86dca9f
@ -42,7 +42,7 @@ impl Pager {
|
||||
metadata.len() as usize
|
||||
}
|
||||
|
||||
pub fn row_location(&self, row_num: usize) -> (usize, usize) {
|
||||
pub fn row_location(&self, row_num: usize) -> Position {
|
||||
let page_num = row_num / ROWS_PER_PAGE;
|
||||
let row_offset = row_num % ROWS_PER_PAGE;
|
||||
let byte_offset = row_offset * ROW_SIZE;
|
||||
|
@ -1,4 +1,4 @@
|
||||
use crate::{layout::*, pager::Pager};
|
||||
use crate::{cursor::Position, layout::*, pager::Pager};
|
||||
|
||||
pub struct Table {
|
||||
pub row_count: usize,
|
||||
@ -11,7 +11,7 @@ impl Table {
|
||||
Self { row_count, pager }
|
||||
}
|
||||
|
||||
pub fn row_slot(&self, index: usize) -> (usize, usize) {
|
||||
pub fn row_slot(&self, index: usize) -> Position {
|
||||
self.pager.row_location(index)
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user