pub enum ErrorFormatObj {
Null,
Bool(bool),
Number(i64),
String(String),
Url(Url),
DateTime(DateTime<Utc>),
SourceLocation(SourceLocation),
FormatString(Vec<ErrorFormatObj>),
ColorString(ColoredString),
Array(Vec<ErrorFormatObj>),
Object(IndexMap<String, ErrorFormatObj>),
}Expand description
An intermediate representation for structured error output.
This is a JSON-like tree that the formatting system builds before converting to a final string. Supports nested objects, arrays, colored strings, source locations, and more.
Variants§
Null
Null/empty value.
Bool(bool)
Boolean value.
Number(i64)
Numeric value.
String(String)
Plain string value.
Url(Url)
URL value.
DateTime(DateTime<Utc>)
Date and time value (UTC).
SourceLocation(SourceLocation)
Source code location (file:line:column).
FormatString(Vec<ErrorFormatObj>)
A sequence of format objects concatenated without separators.
ColorString(ColoredString)
A string with ANSI color codes.
Array(Vec<ErrorFormatObj>)
An ordered list of format objects.
Object(IndexMap<String, ErrorFormatObj>)
A key-value map of format objects (insertion-ordered).
Implementations§
Source§impl ErrorFormatObj
impl ErrorFormatObj
Sourcepub fn filter_object_fields(
&self,
list: Vec<&str>,
) -> Result<Self, FilterObjectError>
pub fn filter_object_fields( &self, list: Vec<&str>, ) -> Result<Self, FilterObjectError>
Keep only the specified keys in an Object variant. Returns an error if
any key in list does not exist.
Sourcepub fn stringify(&self, settings: ErrorFmtSettings) -> ResultER<String>
pub fn stringify(&self, settings: ErrorFmtSettings) -> ResultER<String>
Convert this format object to a formatted string.
Trait Implementations§
Source§impl Clone for ErrorFormatObj
impl Clone for ErrorFormatObj
Source§fn clone(&self) -> ErrorFormatObj
fn clone(&self) -> ErrorFormatObj
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ErrorFormatObj
impl RefUnwindSafe for ErrorFormatObj
impl Send for ErrorFormatObj
impl Sync for ErrorFormatObj
impl Unpin for ErrorFormatObj
impl UnwindSafe for ErrorFormatObj
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