pub struct Handler { /* private fields */ }
Expand description

A handler is responsible for emitting warnings and errors

Implementations§

source§

impl Handler

source

pub fn new(input_path: PathBuf, input_content: String) -> Self

Creates a new Handler input_path refers to the path of the input file input_content refers to the content of the input file

source

pub fn without_file(input_content: String) -> Self

Creates a new handler without a path.

source

pub fn emit(&self, diag: &Diagnostic)

Emits a single Diagnostic to the terminal

source

pub fn emit_error(&self, err: &RtLolaError)

Emits a RtLolaError to the console

source

pub fn contains_error(&self) -> bool

Returns true if an error has occurred

source

pub fn emitted_errors(&self) -> usize

Returns the number of emitted errors

source

pub fn emitted_warnings(&self) -> usize

Returns the number of emitted warnings

source

pub fn warn(&self, message: &str)

Emits a simple warning with a message

source

pub fn warn_with_span(&self, message: &str, span: Span, span_label: Option<&str>)

Emits a warning referring to the code span span with and optional label span_label that is printed next to the code fragment

source

pub fn error(&self, message: &str)

Emits a simple error with a message

source

pub fn error_with_span(&self, message: &str, span: Span, span_label: Option<&str>)

Emits an error referring to the code span span with and optional label span_label that is printed next to the code fragment

Trait Implementations§

source§

impl Debug for Handler

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere
    T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere
    T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere
    T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere
    U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere
    U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere
    U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.