Skip to main content

StringInterpolation

Trait StringInterpolation 

Source
pub trait StringInterpolation<T>
where T: AsRef<str> + ToString,
{ // Required methods fn replace_placeholder_with_string( &self, placeholder: &str, value: &str, ) -> String; fn with_indent(&self, spaces: usize) -> String; fn with_additional_indent(&self, spaces: usize) -> String; }
Expand description

Add enhanced string interpolation functionality

Required Methods§

Source

fn replace_placeholder_with_string( &self, placeholder: &str, value: &str, ) -> String

Replace placeholder instances with a given value (basic interpolation based on handlebars template syntax)

Source

fn with_indent(&self, spaces: usize) -> String

Prepend indentation of a given number of spaces to each line of a text

Source

fn with_additional_indent(&self, spaces: usize) -> String

Prepend indentation while preserving indentation already present on each line

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl<T> StringInterpolation<T> for T
where T: ToString + AsRef<str>,