pub struct AlignCenterRight;Expand description
Pad to both sides, place content in the middle, but shift to the right one block if it can’t be exactly central.
Example:
use zero_copy_pads::{AlignCenterRight, PaddedColumn, PanicOnExcess};
let values = [
"Rust", "C", "C++", "C#", "JavaScript",
"TypeScript", "Java", "Kotlin", "Go",
];
let padded_column = PaddedColumn {
pad: AlignCenterRight,
values: values.iter(),
pad_block: '-',
};
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);Trait Implementations§
Source§impl Clone for AlignCenterRight
impl Clone for AlignCenterRight
Source§fn clone(&self) -> AlignCenterRight
fn clone(&self) -> AlignCenterRight
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for AlignCenterRight
impl Debug for AlignCenterRight
Source§impl Default for AlignCenterRight
impl Default for AlignCenterRight
Source§fn default() -> AlignCenterRight
fn default() -> AlignCenterRight
Returns the “default value” for a type. Read more
Source§impl PartialEq for AlignCenterRight
impl PartialEq for AlignCenterRight
Source§impl Unit for AlignCenterRight
impl Unit for AlignCenterRight
impl Copy for AlignCenterRight
impl Eq for AlignCenterRight
impl StructuralPartialEq for AlignCenterRight
impl<Value: Width, PadBlock: Display> UnitPad<Value, PadBlock> for AlignCenterRight
Auto Trait Implementations§
impl Freeze for AlignCenterRight
impl RefUnwindSafe for AlignCenterRight
impl Send for AlignCenterRight
impl Sync for AlignCenterRight
impl Unpin for AlignCenterRight
impl UnwindSafe for AlignCenterRight
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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