Skip to main content

ExpandTabs

Trait ExpandTabs 

Source
pub trait ExpandTabs<'a> {
    // Required method
    fn expand_tabs(self, spaces: usize) -> Cow<'a, str>;
}
Available on crate feature alloc only.
Expand description

To extend str and Cow<str> to have expand_tabs method.

This replaces each tab with a fixed number of spaces and does not align to tab stops.

Required Methods§

Source

fn expand_tabs(self, spaces: usize) -> Cow<'a, str>

Returns a Cow<str> where each tab is replaced with spaces spaces.

Passing 0 removes tabs.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<'a> ExpandTabs<'a> for &'a str

Source§

fn expand_tabs(self, spaces: usize) -> Cow<'a, str>

Source§

impl<'a> ExpandTabs<'a> for Cow<'a, str>

Source§

fn expand_tabs(self, spaces: usize) -> Cow<'a, str>

Implementors§