Function zero_copy_pads::align_left [−][src]
pub fn align_left<Value: Width>(
value: Value,
total_width: usize
) -> PaddedValue<Value, char, IgnoreExcess, AlignLeft>
Pad space characters to the right of a value.
When value.width()
is not greater than total_width
,
add space characters to the right of value
to make its
width equals to total_width
:
use zero_copy_pads::align_left; let value = "abc"; let padded_value = align_left(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_left; let value = "abcdefghi"; let padded_value = align_left(value, 5); assert_eq!(padded_value.to_string(), value);