Struct psl::Diagnostics

source ·
pub struct Diagnostics { /* private fields */ }
Expand description

Represents a list of validation or parser errors and warnings.

This is used to accumulate multiple errors and warnings during validation. It is used to not error out early and instead show multiple errors at once.

Implementations§

source§

impl Diagnostics

source

pub fn new() -> Diagnostics

source

pub fn warnings(&self) -> &[DatamodelWarning]

source

pub fn into_warnings(self) -> Vec<DatamodelWarning>

source

pub fn errors(&self) -> &[DatamodelError]

source

pub fn push_error(&mut self, err: DatamodelError)

source

pub fn push_warning(&mut self, warning: DatamodelWarning)

source

pub fn has_errors(&self) -> bool

Returns true, if there is at least one error in this collection.

source

pub fn to_result(&mut self) -> Result<(), Diagnostics>

source

pub fn to_pretty_string( &self, file_name: &str, datamodel_string: &str ) -> String

source

pub fn warnings_to_pretty_string( &self, file_name: &str, datamodel_string: &str ) -> String

Trait Implementations§

source§

impl Debug for Diagnostics

source§

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

Formats the value using the given formatter. Read more
source§

impl Default for Diagnostics

source§

fn default() -> Diagnostics

Returns the “default value” for a type. Read more
source§

impl From<DatamodelError> for Diagnostics

source§

fn from(error: DatamodelError) -> Diagnostics

Converts to this type from the input type.
source§

impl From<DatamodelWarning> for Diagnostics

source§

fn from(warning: DatamodelWarning) -> Diagnostics

Converts to this type from the input type.

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,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

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.
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.
source§

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

Performs the conversion.