Skip to main content

PadRight

Struct PadRight 

Source
pub struct PadRight<T> { /* private fields */ }
Expand description

Right-pads formatted output to width characters using fill.

Single-pass: streams inner value through format_with counting chars, then appends fill characters if the output was shorter than width.

Trait Implementations§

Source§

impl<T: Display> Display for PadRight<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<T> Freeze for PadRight<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for PadRight<T>
where T: RefUnwindSafe,

§

impl<T> Send for PadRight<T>
where T: Send,

§

impl<T> Sync for PadRight<T>
where T: Sync,

§

impl<T> Unpin for PadRight<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for PadRight<T>
where T: UnsafeUnpin,

§

impl<T> UnwindSafe for PadRight<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> DisplayExt for T
where T: Display + ?Sized,

Source§

fn is_empty(&self) -> bool

Source§

fn write_to_fmt<W>(&self, writer: W) -> Result<(), Error>
where W: Write,

Source§

fn write_to_bytes<W>(&self, writer: W) -> Result<(), Error>
where W: Write,

Source§

fn format_with<F>(&self, cb: F) -> Result<(), Error>
where F: FnMut(Option<&str>) -> Result<(), Error>,

Source§

fn try_to_fmt<T>(&self) -> Result<T, T>
where T: Write + Default,

Source§

fn try_to_bytes<T>(&self) -> Result<T, T>
where T: Write + Default,

Source§

fn to_fmt<T>(&self) -> T
where T: Write + Default,

Source§

fn to_bytes<T>(&self) -> T
where T: Write + Default,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> SmartFormat for T
where T: Display,

Source§

fn display_wrap<P: Display, S: Display>( self, prefix: P, suffix: S, ) -> Wrap<Self, P, S>

Wrap with a prefix and suffix: prefix + self + suffix.
Source§

fn display_prefix<P: Display>(self, prefix: P) -> Prefix<Self, P>

Prepend a prefix: prefix + self.
Source§

fn display_suffix<S: Display>(self, suffix: S) -> Suffix<Self, S>

Append a suffix: self + suffix.
Source§

fn display_if(self, condition: bool) -> If<Self>

Conditionally display: if condition is true, display self; otherwise write nothing.
Source§

fn display_or_if<U: Display>( self, use_fallback: bool, fallback: U, ) -> Or<Self, U>

Conditionally choose: if use_fallback is false, display self; otherwise display fallback. Read more
Source§

fn display_truncate(self, max_chars: usize) -> Truncate<Self>

Truncate to at most max_chars Unicode scalar values. Read more
Source§

fn display_truncate_with( self, max_chars: usize, tail: &'static str, ) -> TruncateWith<Self>

Truncate with a tail indicator (e.g., “…”). Read more
Source§

fn display_pad_right(self, width: usize, fill: char) -> PadRight<Self>

Right-pad to width characters using fill. Read more
Source§

fn display_pad_left(self, width: usize, fill: char) -> PadLeft<Self>

Left-pad to width characters using fill. Read more
Source§

impl<T> SmartFormatCase for T
where T: Display,

Source§

fn capitalize(self) -> Capitalize<T>
where T: Display,

Source§

fn lowercase(self) -> Lowercase<T>
where T: Display,

Source§

fn uppercase(self) -> Uppercase<T>
where T: Display,

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.