Skip to main content

oxilean_parse/error/
parseerrorcontext_traits.rs

1//! # ParseErrorContext - Trait Implementations
2//!
3//! This module contains trait implementations for `ParseErrorContext`.
4//!
5//! ## Implemented Traits
6//!
7//! - `Display`
8//!
9//! 🤖 Generated with [SplitRS](https://github.com/cool-japan/splitrs)
10
11use super::types::ParseErrorContext;
12
13impl std::fmt::Display for ParseErrorContext {
14    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
15        if let Some(decl) = &self.decl_name {
16            write!(f, "in decl '{}': ", decl)?;
17        }
18        if let Some(phase) = &self.phase {
19            write!(f, "[{}] ", phase)?;
20        }
21        write!(f, "{}", self.error.message())
22    }
23}