[][src]Struct colonnade::Column

pub struct Column { /* fields omitted */ }

A struct holding formatting information for a particular column.

Methods

impl Column[src]

pub fn priority(&mut self, priority: usize)[src]

Assign a particular priority to the column.

Priority determines the order in which columns give up space when the viewport lacks sufficient space to display all columns without wrapping. Lower priority columns give up space first.

Arguments

  • priority - The column's priority. Lower numbers confer higher priority; 0 is the highest priority.

Example

let mut colonnade = Colonnade::new(4, 100)?;
// assign all columns the highest priority
colonnade.priority(0);
// now demote the last column
colonnade.columns[3].priority(1);

pub fn max_width(&mut self, max_width: usize) -> Result<(), ColonnadeError>[src]

Assign the same maximum width to all columns. By default columns have no maximum width.

Arguments

  • max_width - The common maximum width.

Errors

  • ColonnadeError::MinGreaterThanMax - Assigning a maximum width in conflict with some assigned minimum width.
  • ColonnadeError::OutOfBounds - Attemping to assign a maximum width to a column that does not exist.

Example

let mut colonnade = Colonnade::new(4, 100)?;
// assign the first column a maximum width of 20
colonnade.columns[0].max_width(20)?;

pub fn min_width(&mut self, min_width: usize) -> Result<(), ColonnadeError>[src]

Assign a particular minimum width to a particular column. By default columns have no minimum width.

Arguments

  • min_width - The common minimum width.

Errors

  • ColonnadeError::MinGreaterThanMax - Assigning a maximum width in conflict with some assigned minimum width.

Example

let mut colonnade = Colonnade::new(4, 100)?;
// assign the first column a minimum width of 20
colonnade.columns[0].min_width(20)?;

pub fn fixed_width(&mut self, width: usize) -> Result<(), ColonnadeError>[src]

Assign a particular maximum and minimum width to a particular column. By default columns have neither a maximum nor a minimum width.

Arguments

  • width - The common width.

Errors

This method is a convenience method which assigns the column in question the same maximum and minimum width. Therefore the errors thrown are those thrown by max_width and min_width.

Example

let mut colonnade = Colonnade::new(4, 100)?;
// assign the first column a width of 20
colonnade.columns[0].fixed_width(20)?;

pub fn clear_limits(&mut self)[src]

Remove maximum or minimum column widths from a particular column.

Example

let mut colonnade = Colonnade::new(4, 100)?;
// initially assign all columns a width of 20
colonnade.fixed_width(20);
// but we want the first column to be flexible
colonnade.columns[0].clear_limits();

pub fn alignment(&mut self, alignment: Alignment)[src]

Assign a particular column a particular alignment. The default alignment is left.

Arguments

  • alignment - The desired alignment.

Example

let mut colonnade = Colonnade::new(4, 100)?;
// the first column should be right-aligned (it's numeric)
colonnade.columns[0].alignment(Alignment::Right);

pub fn vertical_alignment(&mut self, vertical_alignment: VerticalAlignment)[src]

Assign a particular column a particular vertical alignment. The default alignment is top.

Arguments

  • vertical_alignment - The desired alignment.

Example

let mut colonnade = Colonnade::new(4, 100)?;
// the first column should be right-aligned (it's numeric)
colonnade.columns[0].vertical_alignment(VerticalAlignment::Middle);

pub fn left_margin(&mut self, left_margin: usize)[src]

Assign a particular column a particular left margin. The left margin is a number of blank spaces before the content of the column. By default the first column has a left margin of 0 and the other columns have a left margin of 1.

Arguments

  • left_margin - The width in blank spaces of the desired margin.

Example

let mut colonnade = Colonnade::new(4, 100)?;
colonnade.columns[0].left_margin(2);

pub fn padding(&mut self, padding: usize)[src]

Assign a particular column a particular padding.

See Colonnade::padding.

Arguments

  • padding - The width in blank spaces/lines of the desired padding.

Example

let mut colonnade = Colonnade::new(4, 100)?;
colonnade.columns[0].padding(1);

pub fn padding_horizontal(&mut self, padding: usize)[src]

Assign a particular column a particular horizontal padding -- space before and after the column's text.

See Colonnade::padding.

Arguments

  • padding - The width in blank spaces/lines of the desired padding.

Example

let mut colonnade = Colonnade::new(4, 100)?;
colonnade.columns[0].padding_horizontal(1);

pub fn padding_left(&mut self, padding: usize)[src]

Assign a particular column a particular left padding -- space before the column's text.

See Colonnade::padding.

Arguments

  • padding - The width in blank spaces/lines of the desired padding.

Example

let mut colonnade = Colonnade::new(4, 100)?;
colonnade.columns[0].padding_left(1);

pub fn padding_right(&mut self, padding: usize)[src]

Assign a particular column a particular right padding -- space after the column's text.

See Colonnade::padding.

Arguments

  • padding - The width in blank spaces/lines of the desired padding.

Example

let mut colonnade = Colonnade::new(4, 100)?;
colonnade.columns[0].padding_right(1);

pub fn padding_vertical(&mut self, padding: usize)[src]

Assign a particular column a particular vertical padding -- blank lines before and after the column's text.

See Colonnade::padding.

Arguments

  • padding - The width in blank spaces/lines of the desired padding.

Example

let mut colonnade = Colonnade::new(4, 100)?;
colonnade.columns[0].padding_vertical(1);

pub fn padding_top(&mut self, padding: usize)[src]

Assign a particular column a particular top padding -- blank lines before the column's text.

See Colonnade::padding.

Arguments

  • padding - The width in blank spaces/lines of the desired padding.

Example

let mut colonnade = Colonnade::new(4, 100)?;
colonnade.columns[0].padding_top(1);

pub fn padding_bottom(&mut self, padding: usize)[src]

Assign a particular column a particular bottom padding -- blank lines after the column's text.

See Colonnade::padding.

Arguments

  • padding - The width in blank spaces/lines of the desired padding.

Example

let mut colonnade = Colonnade::new(4, 100)?;
colonnade.columns[0].padding_bottom(1);

Trait Implementations

impl Clone for Column[src]

impl Debug for Column[src]

Auto Trait Implementations

impl Send for Column

impl Sync for Column

impl Unpin for Column

impl UnwindSafe for Column

impl RefUnwindSafe for Column

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = !

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]