Struct calypso_diagnostic::diagnostic::builder::Builder
source · Expand description
A builder for a single diagnostic.
Fields§
§diag: CodespanDiag<usize>
§labels: Vec<Label<usize>>
§notes: Vec<String>
Implementations§
source§impl Builder
impl Builder
sourcepub fn code(self, code: &'static str) -> Self
pub fn code(self, code: &'static str) -> Self
Set the code of the diagnostic. This will overwrite whatever code was already present, if any.
sourcepub fn short(self, short: impl Into<String>) -> Self
pub fn short(self, short: impl Into<String>) -> Self
Set the short message of the diagnostic. This will overwrite whatever short message was already present, if any.
sourcepub fn label(
self,
style: LabelStyle,
message: Option<&str>,
file_id: usize,
span: Span
) -> Self
pub fn label(
self,
style: LabelStyle,
message: Option<&str>,
file_id: usize,
span: Span
) -> Self
Add a label to the diagnostic.
sourcepub fn build(self) -> Diagnostic
pub fn build(self) -> Diagnostic
Build the diagnostic.