Struct sway_error::handler::Handler
source · pub struct Handler { /* private fields */ }
Expand description
A handler with which you can emit diagnostics.
Implementations§
source§impl Handler
impl Handler
pub fn from_parts( errors: Vec<CompileError>, warnings: Vec<CompileWarning> ) -> Self
sourcepub fn emit_err(&self, err: CompileError) -> ErrorEmitted
pub fn emit_err(&self, err: CompileError) -> ErrorEmitted
Emit the error err
.
sourcepub fn emit_warn(&self, warn: CompileWarning)
pub fn emit_warn(&self, warn: CompileWarning)
Emit the warning warn
.
pub fn has_errors(&self) -> bool
pub fn has_warnings(&self) -> bool
pub fn scope<T>( &self, f: impl FnOnce(&Handler) -> Result<T, ErrorEmitted> ) -> Result<T, ErrorEmitted>
sourcepub fn consume(self) -> (Vec<CompileError>, Vec<CompileWarning>)
pub fn consume(self) -> (Vec<CompileError>, Vec<CompileWarning>)
Extract all the errors from this handler.
pub fn append(&self, other: Handler)
pub fn dedup(&self)
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Handler
impl Send for Handler
impl !Sync for Handler
impl Unpin for Handler
impl UnwindSafe for Handler
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