rpos
A cursor manager on table for Rust.
Overview
rpos provides a simple and intuitive way to manage cursor position on a 2D table with bounds checking. The cursor can navigate within the table using directional movements (up, down, left, right) or by setting specific positions.
Installation
Add this to your Cargo.toml:
[]
= "0.3.1"
Usage
Creating a Table with Cursor
use Table;
Moving the Cursor
use Table;
Setting Cursor Position
use Table;
Boundary Safety
The cursor automatically stays within table bounds:
use Table;
API Reference
Table
| Method | Description |
|---|---|
Table::new(height, width) |
Creates a new table with specified dimensions |
Cursor
| Method | Description |
|---|---|
current() |
Returns current position as (line, column) |
set(line, column) |
Sets cursor to specific position |
set_line(line) |
Sets cursor line (row) |
set_column(column) |
Sets cursor column |
up() |
Moves cursor up one position |
down() |
Moves cursor down one position |
left() |
Moves cursor left one position |
right() |
Moves cursor right one position |
License
MIT License - see LICENSE for details.