pub fn format_multi_span(
title: &str,
labels: &[SpanLabel],
source_code: &str,
filename: &str,
start_line: u32,
renderer: &Renderer,
) -> StringExpand description
Renders title with several labelled annotations over source_code, the first as the
primary caret and the rest as secondary context, in rustc style.
- Precondition:
labelsis non-empty. - Complexity: O(n) in
source_code’s length plus the number of labels.
§Examples
use annotate_snippets::Renderer;
use cel_parser::{SourceSpan, SpanLabel, format_multi_span};
let labels = vec![SpanLabel { span: SourceSpan::new(1, 0, 1, 1), label: "here".into() }];
let out = format_multi_span("oops", &labels, "x", "f.adm2", 1, &Renderer::plain());
assert!(out.contains("oops"));