pub struct Table<'a> {
pub centered: bool,
/* private fields */
}
Fields§
§centered: bool
Represents whether or not the table is centered
Implementations§
Source§impl Table<'_>
impl Table<'_>
pub fn to_borrowed(&self) -> Table<'_>
pub fn into_owned(self) -> Table<'static>
Source§impl<'a> Table<'a>
impl<'a> Table<'a>
pub fn new<I: IntoIterator<Item = (CellPos, Located<Cell<'a>>)>>( cells: I, centered: bool, ) -> Self
Sourcepub fn header_rows(&self) -> HeaderRows<'_, 'a> ⓘ
pub fn header_rows(&self) -> HeaderRows<'_, 'a> ⓘ
Returns an iterator over all rows that are considered header rows, which is all rows leading up to a divider row. If there is no divider row, then there are no header rows
Sourcepub fn body_rows(&self) -> BodyRows<'_, 'a> ⓘ
pub fn body_rows(&self) -> BodyRows<'_, 'a> ⓘ
Returns an iterator over all rows that are considered body rows, which is all rows following a divider row. If there is no divider row in the table, then all rows are considered body rows
Sourcepub fn has_header_rows(&self) -> bool
pub fn has_header_rows(&self) -> bool
Returns true if contains header rows
Sourcepub fn has_body_rows(&self) -> bool
pub fn has_body_rows(&self) -> bool
Returns true if contains body rows
Sourcepub fn has_divider_row(&self) -> bool
pub fn has_divider_row(&self) -> bool
Returns true if the table contains a divider row
Sourcepub fn get_divider_row_index(&self) -> Option<usize>
pub fn get_divider_row_index(&self) -> Option<usize>
Returns the row index representing the divider row of the table (separation between header and body) if it exists
Sourcepub fn get_column_alignment(&self, col: usize) -> ColumnAlign
pub fn get_column_alignment(&self, col: usize) -> ColumnAlign
Returns the alignment of the specified column within the table
NOTE: This will always return an alignment, even if the column does not exist, by using the default column alignment
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true if the total cells (rows * columns) contained in the table is zero
Sourcepub fn as_data(&self) -> &HashMap<CellPos, Located<Cell<'a>>>
pub fn as_data(&self) -> &HashMap<CellPos, Located<Cell<'a>>>
Returns raw table cell data as a reference to the hashmap
Sourcepub fn row(&self, idx: usize) -> Row<'_, 'a> ⓘ
pub fn row(&self, idx: usize) -> Row<'_, 'a> ⓘ
Returns an iterator of refs through a specific row in the table
Sourcepub fn into_row(self, idx: usize) -> IntoRow<'a> ⓘ
pub fn into_row(self, idx: usize) -> IntoRow<'a> ⓘ
Consumes the table and returns an iterator through a specific row in the table
Sourcepub fn columns(&self) -> Columns<'_, 'a> ⓘ
pub fn columns(&self) -> Columns<'_, 'a> ⓘ
Returns an iterator of refs through all columns in the table
Sourcepub fn column(&self, idx: usize) -> Column<'_, 'a> ⓘ
pub fn column(&self, idx: usize) -> Column<'_, 'a> ⓘ
Returns an iterator of refs through a specific column in the table
Sourcepub fn into_column(self, idx: usize) -> IntoColumn<'a> ⓘ
pub fn into_column(self, idx: usize) -> IntoColumn<'a> ⓘ
Consumes the table and returns an iterator through a specific column in the table
Sourcepub fn cells(&self) -> Cells<'_, 'a> ⓘ
pub fn cells(&self) -> Cells<'_, 'a> ⓘ
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
Sourcepub fn into_cells(self) -> IntoCells<'a> ⓘ
pub fn into_cells(self) -> IntoCells<'a> ⓘ
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
Sourcepub fn get_cell(&self, row: usize, col: usize) -> Option<&Located<Cell<'a>>>
pub fn get_cell(&self, row: usize, col: usize) -> Option<&Located<Cell<'a>>>
Returns reference to the cell found at the specified row and column
Sourcepub fn get_mut_cell(
&mut self,
row: usize,
col: usize,
) -> Option<&mut Located<Cell<'a>>>
pub fn get_mut_cell( &mut self, row: usize, col: usize, ) -> Option<&mut Located<Cell<'a>>>
Returns mut reference to the cell found at the specified row and column
Sourcepub fn get_cell_rowspan(&self, row: usize, col: usize) -> usize
pub fn get_cell_rowspan(&self, row: usize, col: usize) -> usize
Returns the cell’s rowspan, which is the number of rows (including itself) that the cell spans. 1 means that the cell only spans its starting row whereas >1 indicates it is 1 or more rows below its starting row
Returns 0 for a non-content cell or a cell that doesn’t exist
Sourcepub fn get_cell_colspan(&self, row: usize, col: usize) -> usize
pub fn get_cell_colspan(&self, row: usize, col: usize) -> usize
Returns the cell’s colspan, which is the number of columns (including itself) that the cell spans. 1 means that the cell only spans its starting column whereas >1 indicates it is 1 or more columns after its starting column
Returns 0 for a non-content cell or a cell that doesn’t exist
Trait Implementations§
Source§impl<'de, 'a> Deserialize<'de> for Table<'a>
impl<'de, 'a> Deserialize<'de> for Table<'a>
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl<'a> From<Table<'a>> for BlockElement<'a>
impl<'a> From<Table<'a>> for BlockElement<'a>
Source§fn from(original: Table<'a>) -> BlockElement<'a>
fn from(original: Table<'a>) -> BlockElement<'a>
Source§impl<'a> IntoChildren for Table<'a>
impl<'a> IntoChildren for Table<'a>
Source§type Child = Located<InlineElement<'a>>
type Child = Located<InlineElement<'a>>
Source§fn into_children(self) -> Vec<Self::Child>
fn into_children(self) -> Vec<Self::Child>
Source§impl<'a, '__deriveMoreLifetime> IntoIterator for &'__deriveMoreLifetime Table<'a>
impl<'a, '__deriveMoreLifetime> IntoIterator for &'__deriveMoreLifetime Table<'a>
Source§type Item = <&'__deriveMoreLifetime HashMap<CellPos, Located<Cell<'a>>> as IntoIterator>::Item
type Item = <&'__deriveMoreLifetime HashMap<CellPos, Located<Cell<'a>>> as IntoIterator>::Item
Source§impl<'a, '__deriveMoreLifetime> IntoIterator for &'__deriveMoreLifetime mut Table<'a>
impl<'a, '__deriveMoreLifetime> IntoIterator for &'__deriveMoreLifetime mut Table<'a>
Source§type Item = <&'__deriveMoreLifetime mut HashMap<CellPos, Located<Cell<'a>>> as IntoIterator>::Item
type Item = <&'__deriveMoreLifetime mut HashMap<CellPos, Located<Cell<'a>>> as IntoIterator>::Item
Source§impl<'a> IntoIterator for Table<'a>
impl<'a> IntoIterator for Table<'a>
impl<'a> Eq for Table<'a>
impl<'a> StructuralPartialEq for Table<'a>
Auto Trait Implementations§
impl<'a> Freeze for Table<'a>
impl<'a> RefUnwindSafe for Table<'a>
impl<'a> Send for Table<'a>
impl<'a> Sync for Table<'a>
impl<'a> Unpin for Table<'a>
impl<'a> UnwindSafe for Table<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self
to use its Binary
implementation when Debug
-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self
to use its Display
implementation when
Debug
-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self
to use its LowerExp
implementation when
Debug
-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self
to use its LowerHex
implementation when
Debug
-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self
to use its Octal
implementation when Debug
-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self
to use its Pointer
implementation when
Debug
-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self
to use its UpperExp
implementation when
Debug
-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self
to use its UpperHex
implementation when
Debug
-formatted.Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self
, then passes self.as_ref()
into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self
, then passes self.as_mut()
into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self
, then passes self.deref()
into the pipe function.Source§impl<T> PipeAsRef for T
impl<T> PipeAsRef for T
Source§impl<T> PipeBorrow for T
impl<T> PipeBorrow for T
Source§impl<T> PipeDeref for T
impl<T> PipeDeref for T
Source§impl<T> PipeRef for T
impl<T> PipeRef for T
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B>
of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B>
of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R>
view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R>
view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target
of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target
of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap()
only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow()
only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref()
only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref()
only in debug builds, and is erased in release
builds.Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap<F, R>(self, func: F) -> Selfwhere
F: FnOnce(&Self) -> R,
fn tap<F, R>(self, func: F) -> Selfwhere
F: FnOnce(&Self) -> R,
Source§fn tap_dbg<F, R>(self, func: F) -> Selfwhere
F: FnOnce(&Self) -> R,
fn tap_dbg<F, R>(self, func: F) -> Selfwhere
F: FnOnce(&Self) -> R,
tap
in debug builds, and does nothing in release builds.Source§fn tap_mut<F, R>(self, func: F) -> Selfwhere
F: FnOnce(&mut Self) -> R,
fn tap_mut<F, R>(self, func: F) -> Selfwhere
F: FnOnce(&mut Self) -> R,
Source§fn tap_mut_dbg<F, R>(self, func: F) -> Selfwhere
F: FnOnce(&mut Self) -> R,
fn tap_mut_dbg<F, R>(self, func: F) -> Selfwhere
F: FnOnce(&mut Self) -> R,
tap_mut
in debug builds, and does nothing in release builds.Source§impl<T, U> TapAsRef<U> for Twhere
U: ?Sized,
impl<T, U> TapAsRef<U> for Twhere
U: ?Sized,
Source§fn tap_ref<F, R>(self, func: F) -> Self
fn tap_ref<F, R>(self, func: F) -> Self
Source§fn tap_ref_dbg<F, R>(self, func: F) -> Self
fn tap_ref_dbg<F, R>(self, func: F) -> Self
tap_ref
in debug builds, and does nothing in release builds.Source§fn tap_ref_mut<F, R>(self, func: F) -> Self
fn tap_ref_mut<F, R>(self, func: F) -> Self
Source§impl<T, U> TapBorrow<U> for Twhere
U: ?Sized,
impl<T, U> TapBorrow<U> for Twhere
U: ?Sized,
Source§fn tap_borrow<F, R>(self, func: F) -> Self
fn tap_borrow<F, R>(self, func: F) -> Self
Source§fn tap_borrow_dbg<F, R>(self, func: F) -> Self
fn tap_borrow_dbg<F, R>(self, func: F) -> Self
tap_borrow
in debug builds, and does nothing in release builds.Source§fn tap_borrow_mut<F, R>(self, func: F) -> Self
fn tap_borrow_mut<F, R>(self, func: F) -> Self
Source§impl<T> TapDeref for T
impl<T> TapDeref for T
Source§fn tap_deref_dbg<F, R>(self, func: F) -> Self
fn tap_deref_dbg<F, R>(self, func: F) -> Self
tap_deref
in debug builds, and does nothing in release builds.Source§fn tap_deref_mut<F, R>(self, func: F) -> Self
fn tap_deref_mut<F, R>(self, func: F) -> Self
self
for modification.