pub trait MarginTrimmable {
// Required method
fn trim_margin_with<M: AsRef<str>>(
&self,
margin_prefix: M,
) -> Option<String>;
// Provided method
fn trim_margin(&self) -> Option<String> { ... }
}Expand description
An interface for removing the margin of multi-line string-like objects.
Required Methods§
Sourcefn trim_margin_with<M: AsRef<str>>(&self, margin_prefix: M) -> Option<String>
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
Noneif not every line starts with amargin_prefix. - Strings without line break unmodified
Provided Methods§
Sourcefn trim_margin(&self) -> Option<String>
fn trim_margin(&self) -> Option<String>
Short-hand for trin_margin_with("|").
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.