Struct diagnostics::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
impl Diagnostics
pub fn new() -> Diagnostics
pub fn warnings(&self) -> &[DatamodelWarning]
pub fn into_warnings(self) -> Vec<DatamodelWarning>
pub fn errors(&self) -> &[DatamodelError]
pub fn push_error(&mut self, err: DatamodelError)
pub fn push_warning(&mut self, warning: DatamodelWarning)
sourcepub fn has_errors(&self) -> bool
pub fn has_errors(&self) -> bool
Returns true, if there is at least one error in this collection.
pub fn to_result(&mut self) -> Result<(), Diagnostics>
pub fn to_pretty_string( &self, file_name: &str, datamodel_string: &str ) -> String
pub fn warnings_to_pretty_string( &self, file_name: &str, datamodel_string: &str ) -> String
Trait Implementations§
source§impl Debug for Diagnostics
impl Debug for Diagnostics
source§impl Default for Diagnostics
impl Default for Diagnostics
source§impl From<DatamodelError> for Diagnostics
impl From<DatamodelError> for Diagnostics
source§fn from(error: DatamodelError) -> Self
fn from(error: DatamodelError) -> Self
Converts to this type from the input type.
source§impl From<DatamodelWarning> for Diagnostics
impl From<DatamodelWarning> for Diagnostics
source§fn from(warning: DatamodelWarning) -> Self
fn from(warning: DatamodelWarning) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl RefUnwindSafe for Diagnostics
impl Send for Diagnostics
impl Sync for Diagnostics
impl Unpin for Diagnostics
impl UnwindSafe for Diagnostics
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