Skip to main content

splice_at

Function splice_at 

Source
fn splice_at(source: &str, mark: &str, snippet: &str) -> String
Expand description

source with the line carrying the first mark replaced by snippet.

The whole line goes, indentation included, so the snippet stands where the mark stood and an empty snippet leaves a blank line rather than an indented tail. A missing mark leaves the source untouched; splice is what rejects one.