Struct core_extensions::strings::LeftPadder[][src]

pub struct LeftPadder<'a> { /* fields omitted */ }
This is supported on crate feature slices only.
Expand description

Add padding to a string in its Display impl.

Example

use core_extensions::strings::LeftPadder;
 
assert_eq!(LeftPadder::new("foo\n bar", 0).to_string(), "foo\n bar");
assert_eq!(LeftPadder::new("foo\n bar", 1).to_string(), " foo\n  bar");
assert_eq!(LeftPadder::new("foo\n bar", 2).to_string(), "  foo\n   bar");
assert_eq!(LeftPadder::new("foo\n bar", 4).to_string(), "    foo\n     bar");
 
 

Implementations

Constructs a LeftPadder

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

This is supported on crate feature phantom only.

Gets a PhantomData<Self>. Read more

This is supported on crate feature phantom only.

Gets a PhantomData<fn() -> Self>, a covariant PhantomData.

This is supported on crate feature phantom only.

Gets a PhantomData<fn(Self)>, a contravariant PhantomData.

This is supported on crate feature phantom only.

Gets a PhantomData<fn(Self) -> Self>, an invariant PhantomData.

This is supported on crate feature phantom only.

Gets a PhantomData<Self>. Read more

This is supported on crate feature phantom only.

Constructs a PhantomData<fn() -> T>, a covariant PhantomData. Read more

This is supported on crate feature phantom only.

Gets a PhantomData<fn(Self)>, a contravariant PhantomData. Read more

This is supported on crate feature phantom only.

Gets a PhantomData<fn(Self) -> Self>, an invariant PhantomData. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

This is supported on crate feature callable only.

For calling CallRef::ref_call_, with the ability to specify the types of the arguments.. Read more

This is supported on crate feature callable only.

For calling CallMut::mut_call_, with the ability to specify the types of the arguments.. Read more

This is supported on crate feature callable only.

For calling CallInto::into_call_, with the ability to specify the types of the arguments.. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.