add tool function to compute the true indentation and newline

This commit is contained in:
amtoine 2023-03-11 11:34:03 +01:00
parent 1d11c388e3
commit ff93bb6894
No known key found for this signature in database
GPG Key ID: 37AAE9B486CFF1AB

View File

@ -258,6 +258,20 @@ pub fn value_to_string(
}
}
fn get_true_indentation(depth: usize, indent: &Option<String>) -> String {
match indent {
Some(i) => i.repeat(depth),
None => "".to_string(),
}
}
fn get_true_newline(indent: &Option<String>) -> String {
match indent {
Some(_) => "\n".to_string(),
None => "".to_string(),
}
}
fn value_to_string_without_quotes(
v: &Value,
span: Span,