Trait trim_margin::MarginTrimmable
[−]
[src]
pub trait MarginTrimmable { fn trim_margin_with<M: AsRef<str>>(
&self,
margin_prefix: M
) -> Option<String>; fn trim_margin(&self) -> Option<String> { ... } }
An interface for removing the margin of multi-line string-like objects.
Required Methods
fn trim_margin_with<M: AsRef<str>>(&self, margin_prefix: M) -> Option<String>
Removes blanks and the margin_prefix
from multiline strings.
If the first or last line is blank (contains only whitespace, tabs, etc.) they are removed. From each remaining line leading blank characters and the subsequent are removed
Returns
- The trimmed string or
None
if not every line starts with amargin_prefix
. - Strings without line break unmodified
Provided Methods
fn trim_margin(&self) -> Option<String>
Short-hand for trin_margin_with("|")
.