pub struct DiagnosticsReporter<'a> { /* private fields */ }
Expand description
Collects compilation diagnostics and presents them in preconfigured way.
Implementations§
source§impl DiagnosticsReporter<'static>
impl DiagnosticsReporter<'static>
sourcepub fn ignoring() -> Self
pub fn ignoring() -> Self
Create a reporter which does not print or collect diagnostics at all.
sourcepub fn stderr() -> Self
pub fn stderr() -> Self
Create a reporter which prints all diagnostics to std::io::Stderr
.
source§impl<'a> DiagnosticsReporter<'a>
impl<'a> DiagnosticsReporter<'a>
sourcepub fn callback(callback: impl FnMut(FormattedDiagnosticEntry) + 'a) -> Self
pub fn callback(callback: impl FnMut(FormattedDiagnosticEntry) + 'a) -> Self
Create a reporter which calls callback
for each diagnostic.
sourcepub fn write_to_string(string: &'a mut String) -> Self
pub fn write_to_string(string: &'a mut String) -> Self
Create a reporter which appends all diagnostics to provided string.
sourcepub fn with_crates(self, crate_ids: &[CrateId]) -> Self
pub fn with_crates(self, crate_ids: &[CrateId]) -> Self
Sets crates to be checked, instead of all crates in the db.
sourcepub fn allow_warnings(self) -> Self
pub fn allow_warnings(self) -> Self
Allows the compilation to succeed if only warnings are emitted.
sourcepub fn check(&mut self, db: &RootDatabase) -> bool
pub fn check(&mut self, db: &RootDatabase) -> bool
Checks if there are diagnostics and reports them to the provided callback as strings.
Returns true
if diagnostics were found.
sourcepub fn ensure(&mut self, db: &RootDatabase) -> Result<(), DiagnosticsError>
pub fn ensure(&mut self, db: &RootDatabase) -> Result<(), DiagnosticsError>
Checks if there are diagnostics and reports them to the provided callback as strings.
Returns Err
if diagnostics were found.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for DiagnosticsReporter<'a>
impl<'a> !RefUnwindSafe for DiagnosticsReporter<'a>
impl<'a> !Send for DiagnosticsReporter<'a>
impl<'a> !Sync for DiagnosticsReporter<'a>
impl<'a> Unpin for DiagnosticsReporter<'a>
impl<'a> !UnwindSafe for DiagnosticsReporter<'a>
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> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more