Struct memtable::FixedTable [−][src]
pub struct FixedTable<T, const ROW: usize, const COL: usize> where
T: Default, { /* fields omitted */ }
Expand description
Represents an inmemory table containing rows & columns of some data T
with a fixed capacity across both rows and columns
Implementations
Creates a new, empty table
Removes all cells contained within the table that are outside the current row & column capacity
pub fn iter(&self) -> ZipPosition<&T, Cells<'_, T, FixedTable<T, ROW, COL>>>ⓘNotable traits for ZipPosition<T, I>
impl<T, I> Iterator for ZipPosition<T, I> where
I: CellIter<T>, type Item = (Position, T);
pub fn iter(&self) -> ZipPosition<&T, Cells<'_, T, FixedTable<T, ROW, COL>>>ⓘNotable traits for ZipPosition<T, I>
impl<T, I> Iterator for ZipPosition<T, I> where
I: CellIter<T>, type Item = (Position, T);
Returns an iterator over the cells and their positions within the table
Trait Implementations
Creates a new table with maximum allocation of ROWxCOL, but with a virtual space (current occupancy) of 0x0
impl<'de, T, const ROW: usize, const COL: usize> Deserialize<'de> for FixedTable<T, ROW, COL> where
T: Default + Deserialize<'de>,
impl<'de, T, const ROW: usize, const COL: usize> Deserialize<'de> for FixedTable<T, ROW, COL> where
T: Default + Deserialize<'de>,
pub fn deserialize<__D>(
__deserializer: __D
) -> Result<FixedTable<T, ROW, COL>, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
pub fn deserialize<__D>(
__deserializer: __D
) -> Result<FixedTable<T, ROW, COL>, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Creates a new table with the provided cells as a starting point. As there is no way to tell how much of the 2D array is being used, the assumption is that the full array is occupied.
If this is incorrect, adjust the virtual row and column counts with
[Table::set_row_capacity
] and [Table::set_column_capacity
] respectively.
impl<T, V, const ROW: usize, const COL: usize> FromIterator<(Position, V)> for FixedTable<T, ROW, COL> where
T: Default,
V: Into<T>,
impl<T, V, const ROW: usize, const COL: usize> FromIterator<(Position, V)> for FixedTable<T, ROW, COL> where
T: Default,
V: Into<T>,
pub fn from_iter<I>(iter: I) -> FixedTable<T, ROW, COL> where
I: IntoIterator<Item = (Position, V)>,
pub fn from_iter<I>(iter: I) -> FixedTable<T, ROW, COL> where
I: IntoIterator<Item = (Position, V)>,
Produces a table from the provided iterator of (position, value). All values that would go outside of the range of the table will be dropped.
pub fn from_iter<I>(iter: I) -> FixedTable<T, ROW, COL> where
I: IntoIterator<Item = (usize, usize, V)>,
pub fn from_iter<I>(iter: I) -> FixedTable<T, ROW, COL> where
I: IntoIterator<Item = (usize, usize, V)>,
Produces a table from the provided iterator of (row, col, value). All values that would go outside of the range of the table will be dropped.
impl<T, const ROW: usize, const COL: usize> IntoIterator for FixedTable<T, ROW, COL> where
T: Default,
impl<T, const ROW: usize, const COL: usize> IntoIterator for FixedTable<T, ROW, COL> where
T: Default,
Converts into an iterator over the table’s cells’ positions and values
type IntoIter = ZipPosition<T, IntoCells<T, FixedTable<T, ROW, COL>>>
type IntoIter = ZipPosition<T, IntoCells<T, FixedTable<T, ROW, COL>>>
Which kind of iterator are we turning this into?
impl<'a, T, const ROW: usize, const COL: usize> IntoIterator for &'a FixedTable<T, ROW, COL> where
T: Default,
impl<'a, T, const ROW: usize, const COL: usize> IntoIterator for &'a FixedTable<T, ROW, COL> where
T: Default,
Converts into an iterator over the table’s cells’ positions and values
type IntoIter = ZipPosition<&'a T, Cells<'a, T, FixedTable<T, ROW, COL>>>
type IntoIter = ZipPosition<&'a T, Cells<'a, T, FixedTable<T, ROW, COL>>>
Which kind of iterator are we turning this into?
impl<T, const ROW: usize, const COL: usize> PartialEq<FixedTable<T, ROW, COL>> for FixedTable<T, ROW, COL> where
T: PartialEq<T> + Default,
impl<T, const ROW: usize, const COL: usize> PartialEq<FixedTable<T, ROW, COL>> for FixedTable<T, ROW, COL> where
T: PartialEq<T> + Default,
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
pub fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
pub fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Will adjust the internal row count tracker to the specified capacity, capping at ROW.
Note that this does not remove any cells from the table in their
old positions. Instead, this updates the virtual space within the
table that is made available for methods like Table::cell
.
If you want to remove the cells that are no longer within capacity,
call Self::truncate
, which will reset them to their default value.
Will adjust the internal column count tracker to the specified capacity, capping at COL.
Note that this does not remove any cells from the table in their
old positions. Instead, this updates the virtual space within the
table that is made available for methods like Table::cell
.
If you want to remove the cells that are no longer within capacity,
call Self::truncate
, which will reset them to their default value.
type Data = T
type Data = T
The type of data stored in individual cells within the table
type Row = FixedList<<FixedTable<T, ROW, COL> as Table>::Data, COL>
type Row = FixedList<<FixedTable<T, ROW, COL> as Table>::Data, COL>
The type of structure to hold a row of data
type Column = FixedList<<FixedTable<T, ROW, COL> as Table>::Data, ROW>
type Column = FixedList<<FixedTable<T, ROW, COL> as Table>::Data, ROW>
The type of structure to hold a column of data
Returns the maximum row capacity of the table
Returns the maximum column capacity of the table
Returns reference to the cell found at the specified row and column Read more
Returns mut reference to the cell found at the specified row and column Read more
pub fn insert_cell(
&mut self,
row: usize,
col: usize,
value: <FixedTable<T, ROW, COL> as Table>::Data
) -> Option<<FixedTable<T, ROW, COL> as Table>::Data>
pub fn insert_cell(
&mut self,
row: usize,
col: usize,
value: <FixedTable<T, ROW, COL> as Table>::Data
) -> Option<<FixedTable<T, ROW, COL> as Table>::Data>
Replaces the given value into the cell of the table at the specified row and column, returning the previous value contained in the cell Read more
pub fn remove_cell(
&mut self,
row: usize,
col: usize
) -> Option<<FixedTable<T, ROW, COL> as Table>::Data>
pub fn remove_cell(
&mut self,
row: usize,
col: usize
) -> Option<<FixedTable<T, ROW, COL> as Table>::Data>
Removes the given value from the cell at the specified position, but does not shift any other cell to fill in the gap Read more
Returns the total cells (rows * columns) contained in the table Read more
Returns true if the total cells (rows * columns) contained in the table is zero Read more
Returns an iterator of refs through all rows in the table Read more
Returns an iterator of refs through a specific row in the table Read more
Consumes the table and returns an iterator through a specific row in the table Read more
Returns an iterator of refs through all columns in the table Read more
Returns an iterator of refs through a specific column in the table Read more
fn into_column(self, idx: usize) -> IntoColumn<Self::Data, Self>ⓘNotable traits for IntoColumn<D, T>
impl<D, T> Iterator for IntoColumn<D, T> where
T: Table<Data = D>, type Item = D;
fn into_column(self, idx: usize) -> IntoColumn<Self::Data, Self>ⓘNotable traits for IntoColumn<D, T>
impl<D, T> Iterator for IntoColumn<D, T> where
T: Table<Data = D>, type Item = D;
Consumes the table and returns an iterator through a specific column in the table Read more
Returns an iterator of refs through all cells in the table, starting from the first row, iterating through all cells from beginning to end, and then moving on to the next row Read more
Consumes the table and returns an iterator through all cells in the table, starting from the first row, iterating through all cells from beginning to end, and then moving on to the next row Read more
Returns whether or not a cell exists at the specified row & column. Note that this is not the same as whether or not the table’s current row & column range would include a cell at that position! Rather, this is reporting if a cell actually exists Read more
Inserts a new row into the table at the given position, shifting down all rows after it Read more
Pushes a row to the end of the table Read more
Removes the row at the specified position, shifting up all rows after it Read more
Inserts a new column into the table at the given position, shifting right all columns after it Read more
Pushes a column to the end of the table Read more
Removes the column at the specified position, shifting left all columns after it Read more
Pops a column off the end of the table Read more
impl<T, const ROW: usize, const COL: usize> StructuralEq for FixedTable<T, ROW, COL> where
T: Default,
impl<T, const ROW: usize, const COL: usize> StructuralPartialEq for FixedTable<T, ROW, COL> where
T: Default,
Auto Trait Implementations
impl<T, const ROW: usize, const COL: usize> RefUnwindSafe for FixedTable<T, ROW, COL> where
T: RefUnwindSafe,
impl<T, const ROW: usize, const COL: usize> Send for FixedTable<T, ROW, COL> where
T: Send,
impl<T, const ROW: usize, const COL: usize> Sync for FixedTable<T, ROW, COL> where
T: Sync,
impl<T, const ROW: usize, const COL: usize> Unpin for FixedTable<T, ROW, COL> where
T: Unpin,
impl<T, const ROW: usize, const COL: usize> UnwindSafe for FixedTable<T, ROW, COL> where
T: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
Writes a table to some instance of the io::Write
trait
Write a table to a string