pub struct Table {
pub n: CellPos,
pub h: CellPos,
pub contents: Array2<Content>,
pub areas: EnumMap<Area, AreaStyle>,
pub borders: EnumMap<Border, BorderStyle>,
pub rules: EnumMap<Axis2, Array2<Option<Border>>>,
pub value_options: ValueOptions,
}Expand description
A table.
Fields§
§n: CellPosNumber of rows and columns.
h: CellPosTable header rows and columns.
This is a subset of n, so h.x <= n.x and
h.y <= n.y.
contents: Array2<Content>Table contents.
The array has n.x columns and n.y rows.
areas: EnumMap<Area, AreaStyle>Styles for areas of the table.
borders: EnumMap<Border, BorderStyle>Styles for borders in the table.
rules: EnumMap<Axis2, Array2<Option<Border>>>§value_options: ValueOptionsHow to present values.
Implementations§
Source§impl Table
impl Table
pub fn new( n: CellPos, headers: CellPos, areas: EnumMap<Area, AreaStyle>, borders: EnumMap<Border, BorderStyle>, value_options: impl Into<ValueOptions>, ) -> Self
pub fn get(&self, coord: CellPos) -> CellRef<'_>
pub fn get_rule(&self, axis: Axis2, pos: CellPos) -> Option<BorderStyle>
pub fn put(&mut self, region: CellRect, inner: CellInner)
pub fn h_line(&mut self, border: Border, x: Range<usize>, y: usize)
pub fn v_line(&mut self, border: Border, x: usize, y: Range<usize>)
pub fn draw_line( &mut self, border: Border, (a, a_value): (Axis2, usize), b_range: Range<usize>, )
pub fn iter_x(&self, y: usize) -> XIter<'_> ⓘ
Sourcepub fn heading_region(&self, pos: CellPos) -> Option<HeadingRegion>
pub fn heading_region(&self, pos: CellPos) -> Option<HeadingRegion>
The heading region that pos is part of, if any.
Sourcepub fn cells(&self) -> Cells<'_> ⓘ
pub fn cells(&self) -> Cells<'_> ⓘ
Iterates across all of the cells in the table, visiting each of them once in top-down, left-to-right order. Spanned cells are visited once, at the point in the iteration where their top-left cell would appear if they were not spanned.
pub fn is_empty(&self) -> bool
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Table
impl RefUnwindSafe for Table
impl Send for Table
impl Sync for Table
impl Unpin for Table
impl UnsafeUnpin for Table
impl UnwindSafe for Table
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
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more