ide_db::syntax_helpers::format_string_exprs

Function with_placeholders

source
pub fn with_placeholders(args: Vec<Arg>) -> Vec<String>
Expand description

Add placeholders like $1 and $2 in place of Arg::Placeholder, and unwraps the Arg::Ident and Arg::Expr enums.

assert_eq!(with_placeholders(vec![Arg::Ident("ident".to_owned()), Arg::Placeholder, Arg::Expr("expr + 2".to_owned())]), vec!["ident".to_owned(), "$1".to_owned(), "expr + 2".to_owned()])