pub enum FormatError {
NotFound {
program: String,
},
Failed {
program: String,
stderr: String,
},
TimedOut {
program: String,
},
NotUtf8 {
program: String,
},
Io {
program: String,
message: String,
},
}Expand description
Why a formatter run produced no edits.
Every variant is a case the caller must handle differently, which
is why this is not a String: “not installed” is routine and
silent on save, “non-zero exit” carries diagnostics the user needs
to see, and “timed out” means a process was killed.
Variants§
NotFound
The program is not on PATH. Routine — a user without
prettier installed should not be nagged on every save.
Failed
The formatter ran and rejected the input. stderr is the
compiler-style diagnostic and belongs in front of the user.
TimedOut
Killed at FORMAT_TIMEOUT.
NotUtf8
The formatter wrote bytes that are not UTF-8. Refusing is the only safe answer: splicing them into the rope would corrupt the buffer.
Io
Spawning or piping failed for a reason other than the program being absent.
Implementations§
Source§impl FormatError
impl FormatError
Sourcepub fn is_noteworthy(&self) -> bool
pub fn is_noteworthy(&self) -> bool
Whether this is worth interrupting the user for.
NotFound is not: it means the tool simply is not installed,
which is a configuration state rather than an event. The others
describe something that went wrong during work the user asked
for.
Trait Implementations§
Source§impl Clone for FormatError
impl Clone for FormatError
Source§fn clone(&self) -> FormatError
fn clone(&self) -> FormatError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for FormatError
impl Debug for FormatError
impl Eq for FormatError
Source§impl PartialEq for FormatError
impl PartialEq for FormatError
impl StructuralPartialEq for FormatError
Auto Trait Implementations§
impl Freeze for FormatError
impl RefUnwindSafe for FormatError
impl Send for FormatError
impl Sync for FormatError
impl Unpin for FormatError
impl UnsafeUnpin for FormatError
impl UnwindSafe for FormatError
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more