Struct zero_copy_pads::PaddedColumn[][src]

pub struct PaddedColumn<ValueIter, PadBlock = char, Pad = Alignment> where
    ValueIter: Iterator,
    ValueIter::Item: Width,
    PadBlock: Display + Copy,
    Pad: Pad<ValueIter::Item, PadBlock> + Copy
{ pub values: ValueIter, pub pad_block: PadBlock, pub pad: Pad, }

Pad all values in a collection to be of same (maximum) width.

Required features: std

Key traits:

Example:

use zero_copy_pads::{PaddedColumn, AlignRight};
let values = vec![
    "Rust", "C", "C++", "C#", "JavaScript",
    "TypeScript", "Java", "Kotlin", "Go",
];
let padded_column = PaddedColumn {
    values: values.iter(),
    pad_block: ' ',
    pad: AlignRight,
};
let padded_values: Vec<_> = padded_column
    .into_iter()
    .map(|x| x.to_string())
    .collect();
let expected = [
    "      Rust", "         C", "       C++",
    "        C#", "JavaScript", "TypeScript",
    "      Java", "    Kotlin", "        Go",
];
assert_eq!(padded_values, expected);

Fields

values: ValueIter

Values to be padded.

pad_block: PadBlock

Block of the pad (expected to have width of 1).

pad: Pad

Where to place the pad.

Trait Implementations

impl<ValueIter: Clone, PadBlock: Clone, Pad: Clone> Clone for PaddedColumn<ValueIter, PadBlock, Pad> where
    ValueIter: Iterator,
    ValueIter::Item: Width,
    PadBlock: Display + Copy,
    Pad: Pad<ValueIter::Item, PadBlock> + Copy
[src]

impl<ValueIter: Copy, PadBlock: Copy, Pad: Copy> Copy for PaddedColumn<ValueIter, PadBlock, Pad> where
    ValueIter: Iterator,
    ValueIter::Item: Width,
    PadBlock: Display + Copy,
    Pad: Pad<ValueIter::Item, PadBlock> + Copy
[src]

impl<ValueIter: Debug, PadBlock: Debug, Pad: Debug> Debug for PaddedColumn<ValueIter, PadBlock, Pad> where
    ValueIter: Iterator,
    ValueIter::Item: Width,
    PadBlock: Display + Copy,
    Pad: Pad<ValueIter::Item, PadBlock> + Copy
[src]

impl<ValueIter, PadBlock, Pad> IntoIterator for PaddedColumn<ValueIter, PadBlock, Pad> where
    ValueIter: Iterator,
    ValueIter::Item: Width,
    PadBlock: Display + Copy,
    Pad: Pad<ValueIter::Item, PadBlock> + Copy
[src]

type Item = PaddedValue<ValueIter::Item, PadBlock, PanicOnExcess, Pad>

The type of the elements being iterated over.

type IntoIter = PaddedColumnIter<ValueIter::Item, PadBlock, Pad>

Which kind of iterator are we turning this into?

Auto Trait Implementations

impl<ValueIter, PadBlock, Pad> RefUnwindSafe for PaddedColumn<ValueIter, PadBlock, Pad> where
    Pad: RefUnwindSafe,
    PadBlock: RefUnwindSafe,
    ValueIter: RefUnwindSafe

impl<ValueIter, PadBlock, Pad> Send for PaddedColumn<ValueIter, PadBlock, Pad> where
    Pad: Send,
    PadBlock: Send,
    ValueIter: Send

impl<ValueIter, PadBlock, Pad> Sync for PaddedColumn<ValueIter, PadBlock, Pad> where
    Pad: Sync,
    PadBlock: Sync,
    ValueIter: Sync

impl<ValueIter, PadBlock, Pad> Unpin for PaddedColumn<ValueIter, PadBlock, Pad> where
    Pad: Unpin,
    PadBlock: Unpin,
    ValueIter: Unpin

impl<ValueIter, PadBlock, Pad> UnwindSafe for PaddedColumn<ValueIter, PadBlock, Pad> where
    Pad: UnwindSafe,
    PadBlock: UnwindSafe,
    ValueIter: UnwindSafe

Blanket Implementations

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

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

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

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 = Infallible

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.