Added Position type for cursor

This commit is contained in:
niku 2023-08-13 13:17:09 +02:00
parent 53870fecce
commit b4a86dca9f
2 changed files with 3 additions and 3 deletions

View File

@ -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;

View File

@ -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)
}