pub struct Report {
pub location: Option<Location>,
pub severity: Severity,
pub message: String,
}Expand description
A diagnostic report.
Fields§
§location: Option<Location>§severity: Severity§message: StringImplementations§
source§impl Report
impl Report
sourcepub fn new(severity: Severity, message: impl Into<String>) -> Self
pub fn new(severity: Severity, message: impl Into<String>) -> Self
Creates a new Report with the given severity and message. Defaults with no Location.
sourcepub fn bug(message: impl Into<String>) -> Self
pub fn bug(message: impl Into<String>) -> Self
Creates a Severity::Bug report with the given message.
sourcepub fn error(message: impl Into<String>) -> Self
pub fn error(message: impl Into<String>) -> Self
Creates a Severity::Error report with the given message.
sourcepub fn warning(message: impl Into<String>) -> Self
pub fn warning(message: impl Into<String>) -> Self
Creates a Severity::Warning report with the given message.
sourcepub fn note(message: impl Into<String>) -> Self
pub fn note(message: impl Into<String>) -> Self
Creates a Severity::Note report with the given message.
sourcepub fn location(self, location: impl Into<Option<Location>>) -> Self
pub fn location(self, location: impl Into<Option<Location>>) -> Self
Adds a location to this diagnostic report.
Examples found in repository?
examples/basic.rs (line 13)
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
fn main() {
let file = File::new("test.txt", "import stds;");
let styles = Styles::styled();
print!(
"{}",
Renderer::new(
&styles,
&[
error!("Could not find package `{}`", "stds")
.location(Location::new(file.clone(), 7)),
note!("Perhaps you meant `std`?")
]
)
);
}Trait Implementations§
impl Eq for Report
impl StructuralPartialEq for Report
Auto Trait Implementations§
impl Freeze for Report
impl RefUnwindSafe for Report
impl Send for Report
impl Sync for Report
impl Unpin for Report
impl UnwindSafe for Report
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)