Skip to main content

Column

Struct Column 

Source
pub struct Column {
Show 13 fields pub header: Option<Box<dyn Renderable + Send + Sync>>, pub footer: Option<Box<dyn Renderable + Send + Sync>>, pub header_style: Style, pub footer_style: Style, pub style: Style, pub justify: JustifyMethod, pub vertical: VerticalAlignMethod, pub overflow: OverflowMethod, pub width: Option<usize>, pub min_width: Option<usize>, pub max_width: Option<usize>, pub ratio: Option<usize>, pub no_wrap: bool, /* private fields */
}
Expand description

A column definition within a table.

Columns define how data in a particular column should be displayed, including headers, footers, styling, and width constraints.

§Note

The justify, vertical, overflow, and no_wrap fields are defined for API compatibility but are not yet fully implemented. They will be applied in a future version. Currently, cell content is rendered with default justification and wrapping.

Fields§

§header: Option<Box<dyn Renderable + Send + Sync>>

Column header content.

§footer: Option<Box<dyn Renderable + Send + Sync>>

Column footer content.

§header_style: Style

Style for the header.

§footer_style: Style

Style for the footer.

§style: Style

Style for column cells.

§justify: JustifyMethod

Horizontal alignment for cell content.

§vertical: VerticalAlignMethod

Vertical alignment for cell content.

§overflow: OverflowMethod

Overflow handling method.

§width: Option<usize>

Fixed width (if set, overrides auto-width).

§min_width: Option<usize>

Minimum width constraint.

§max_width: Option<usize>

Maximum width constraint.

§ratio: Option<usize>

Flexible width ratio (for distributing extra space).

§no_wrap: bool

Prevent text wrapping in this column.

Implementations§

Source§

impl Column

Source

pub fn new() -> Self

Create a new column with default settings.

Source

pub fn with_header_str(header: &str) -> Self

Create a column with a string header.

Source

pub fn with_header(header: Box<dyn Renderable + Send + Sync>) -> Self

Create a column with a renderable header.

Source

pub fn header_style(self, style: Style) -> Self

Set the header style.

Source

pub fn footer_style(self, style: Style) -> Self

Set the footer style.

Source

pub fn style(self, style: Style) -> Self

Set the cell style.

Source

pub fn justify(self, justify: JustifyMethod) -> Self

Set the horizontal alignment.

Source

pub fn vertical(self, vertical: VerticalAlignMethod) -> Self

Set the vertical alignment.

Source

pub fn width(self, width: usize) -> Self

Set a fixed width.

Source

pub fn min_width(self, width: usize) -> Self

Set the minimum width.

Source

pub fn max_width(self, width: usize) -> Self

Set the maximum width.

Source

pub fn ratio(self, ratio: usize) -> Self

Set the ratio for flexible width distribution.

Source

pub fn no_wrap(self, no_wrap: bool) -> Self

Set no_wrap mode.

Set the footer content (builder pattern).

Source

pub fn flexible(&self) -> bool

Check if this column is flexible (has a ratio set).

Source

pub fn set_justify(&mut self, justify: JustifyMethod)

Set the column justification.

Source

pub fn set_style(&mut self, style: Style)

Set the column style.

Source

pub fn set_header_style(&mut self, style: Style)

Set the header style.

Set the footer style.

Trait Implementations§

Source§

impl Debug for Column

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Column

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for Column

§

impl !RefUnwindSafe for Column

§

impl Send for Column

§

impl Sync for Column

§

impl Unpin for Column

§

impl !UnwindSafe for Column

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.