pub fn snippet_for_code<'a, 'b>(
snippets: &'b mut Vec<Snippet<'a>>,
code: &'a Code,
) -> &'b mut Snippet<'a>Expand description
Returns a mutable reference to the snippet for the given code, creating it if necessary.
This is a utility function used in constructing a vector of snippets.
If a snippet for the given code already exists in the vector, this function returns a mutable reference to that snippet. Otherwise, it creates a new snippet with the given code and appends it to the vector, returning a mutable reference to the newly created snippet.