Documentation
¶
Index ¶
- Variables
- type Table
- func (t Table[T]) CellAt(x, y int) T
- func (t *Table[T]) Cleanup()
- func (t Table[T]) Height() int
- func (t *Table[T]) ResizeHeight(new_height int) error
- func (t *Table[T]) ResizeWidth(new_width int) error
- func (t Table[T]) Row() iter.Seq2[int, []T]
- func (t *Table[T]) SetCellAt(cell T, x, y int)
- func (t Table[T]) Width() int
Constants ¶
This section is empty.
Variables ¶
var SD tablesT
SD is the namespace for SD-like functions.
Functions ¶
This section is empty.
Types ¶
type Table ¶
type Table[T any] struct { // contains filtered or unexported fields }
Table is a boundless table. This means that any operation done to out-of-bounds cells will not cause any error.
func NewTable ¶
NewTable creates a new Table with a width and height.
Parameters:
- width: The width of the table.
- height: The height of the table.
Returns:
- *Table: The new Table.
- error: If the table could not be created.
Errors:
- errors.BadParameterError: If width or height is negative.
func (Table[T]) CellAt ¶
CellAt returns the cell at the specified position.
Parameters:
- x: The x position of the cell.
- y: The y position of the cell.
Returns:
- T: The cell at the specified position. The zero value if the position is out of bounds.
func (*Table[T]) Cleanup ¶
func (t *Table[T]) Cleanup()
Cleanup cleans up the table. Does nothing if the receiver is nil or if is already cleaned up.
func (Table[T]) Height ¶
Height returns the height of the table.
Returns:
- int: The height of the table.
func (*Table[T]) ResizeHeight ¶
ResizeHeight resizes the height of the table. The height is not resized if the receiver is nil or the new height is the same as the current height.
Parameters:
- new_height: The new height of the table.
Returns:
- error: If the table could not be resized.
Errors:
- gers.BadParameterError: If new_height is negative.
func (*Table[T]) ResizeWidth ¶
ResizeWidth resizes the width of the table. The width is not resized if the receiver is nil or the new width is the same as the current width.
Parameters:
- new_width: The new width of the table.
Returns:
- error: If the table could not be resized.
Errors:
- gers.BadParameterError: If new_width is negative.
func (Table[T]) Row ¶
Row returns an iterator over the rows in the table.
Returns:
- iter.Seq2[int, []T]: An iterator over the rows in the table. Never returns nil.