pub struct FracturedJsonError {
pub message: String,
pub input_position: Option<InputPosition>,
}Expand description
Error type returned by formatting operations.
This error is returned when JSON parsing fails (invalid syntax, unexpected tokens) or when formatting constraints are violated (recursion limit exceeded, etc.).
When the error is associated with a specific location in the input, the
input_position field will contain the position information, and the
message will include human-readable location details.
§Example
use fracturedjson::Formatter;
let mut formatter = Formatter::new();
let result = formatter.reformat("{ invalid json }", 0);
match result {
Ok(_) => println!("Success"),
Err(e) => {
println!("Error: {}", e);
if let Some(pos) = e.input_position {
println!("At row {}, column {}", pos.row, pos.column);
}
}
}Fields§
§message: StringThe error message, including position information if available.
input_position: Option<InputPosition>The position in the input where the error occurred, if applicable.
Implementations§
Source§impl FracturedJsonError
impl FracturedJsonError
Trait Implementations§
Source§impl Clone for FracturedJsonError
impl Clone for FracturedJsonError
Source§fn clone(&self) -> FracturedJsonError
fn clone(&self) -> FracturedJsonError
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 moreSource§impl Debug for FracturedJsonError
impl Debug for FracturedJsonError
Source§impl Display for FracturedJsonError
impl Display for FracturedJsonError
Source§impl Error for FracturedJsonError
impl Error for FracturedJsonError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for FracturedJsonError
impl RefUnwindSafe for FracturedJsonError
impl Send for FracturedJsonError
impl Sync for FracturedJsonError
impl Unpin for FracturedJsonError
impl UnwindSafe for FracturedJsonError
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