Function zero_copy_pads::align_right[][src]

pub fn align_right<Value: Width>(
    value: Value,
    total_width: usize
) -> PaddedValue<Value, char, IgnoreExcess, AlignRight>

Pad space characters to the left of a value.

When value.width() is not greater than total_width, add space characters to the left of value to make its width equals to total_width:

use zero_copy_pads::align_right;
let value = "abc";
let padded_value = align_right(value, 5);
assert_eq!(padded_value.to_string(), "  abc");

When value.width() is greater than total_width, display value as is:

use zero_copy_pads::align_right;
let value = "abcdefghi";
let padded_value = align_right(value, 5);
assert_eq!(padded_value.to_string(), value);