pub enum FormatFileError {
Io(Error),
Format {
source: String,
error: FormatSourceError,
},
}Expand description
Describes an I/O failure or retains the source and diagnostic for refused formatting.
format_file stores the original source in Self::Format without changing the file.
§Examples
use adam_fmt::{FormatFileError, render_error};
use std::{io, path::Path};
let error = FormatFileError::Io(io::Error::other("unavailable"));
assert_eq!(
render_error(Path::new("sheet.adm2"), &error),
"adam-fmt: sheet.adm2: unavailable\n"
);Variants§
Io(Error)
path could not be read, or (only after formatting succeeds and differs) written back.
Format
path’s contents could not be safely formatted.
Fields
§
source: Stringpath’s original contents, needed by render_error to render a source-anchored
diagnostic.
§
error: FormatSourceErrorWhy formatting was refused.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for FormatFileError
impl !Send for FormatFileError
impl !Sync for FormatFileError
impl !UnwindSafe for FormatFileError
impl Freeze for FormatFileError
impl Unpin for FormatFileError
impl UnsafeUnpin for FormatFileError
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