Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/renderer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ use crate::renderer::source_map::{
};
use crate::renderer::styled_buffer::StyledBuffer;
use crate::snippet::Id;
use crate::{Annotation, AnnotationKind, Element, Group, Message, Origin, Patch, Snippet, Title};
use crate::{
Annotation, AnnotationKind, Element, Group, Message, Origin, Patch, Report, Snippet, Title,
};
pub use anstyle::*;
use margin::Margin;
use std::borrow::Cow;
Expand Down Expand Up @@ -225,7 +227,7 @@ impl Renderer {

impl Renderer {
/// Render a diagnostic, a series of [`Group`]s
pub fn render(&self, groups: &[Group<'_>]) -> String {
pub fn render(&self, groups: Report<'_>) -> String {
if self.short_message {
self.render_short_message(groups).unwrap()
} else {
Expand Down
7 changes: 7 additions & 0 deletions src/snippet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ pub(crate) const INFO_TXT: &str = "info";
pub(crate) const NOTE_TXT: &str = "note";
pub(crate) const WARNING_TXT: &str = "warning";

/// A [diagnostic message][Title] and any associated context to help users
/// understand it
///
/// The first [`Group`] is the "primary" group, ie it contains the diagnostic
/// message. All subsequent [`Group`]s are for distinct pieces of context.
pub type Report<'a> = &'a [Group<'a>];

#[derive(Clone, Debug, Default)]
pub(crate) struct Id<'a> {
pub(crate) id: Option<Cow<'a, str>>,
Expand Down
Loading