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:
IntoIterator
: Build an iterator of padded values.
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: 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]fn clone(&self) -> PaddedColumn<ValueIter, PadBlock, Pad>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[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: 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: 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]
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?
fn into_iter(self) -> Self::IntoIter
[src]
Auto Trait Implementations
impl<ValueIter, PadBlock, Pad> RefUnwindSafe for PaddedColumn<ValueIter, PadBlock, Pad> where
Pad: RefUnwindSafe,
PadBlock: RefUnwindSafe,
ValueIter: RefUnwindSafe,
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> 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> 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> 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,
impl<ValueIter, PadBlock, Pad> UnwindSafe for PaddedColumn<ValueIter, PadBlock, Pad> where
Pad: UnwindSafe,
PadBlock: UnwindSafe,
ValueIter: UnwindSafe,