#[non_exhaustive]pub enum OutputFormat {
Pretty,
Json,
}Expand description
The rendering format for an error reported to a consumer.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Pretty
The human-readable Error: {display} line.
Json
The RFC 9457 application/problem+json envelope.
Implementations§
Source§impl OutputFormat
impl OutputFormat
Sourcepub fn select(explicit: Option<&str>, is_terminal: bool) -> Self
pub fn select(explicit: Option<&str>, is_terminal: bool) -> Self
Selects the output format for a consumer.
JSON when --format=json is given explicitly, or when no format is
given and the error stream is not a terminal. Pretty when
--format=pretty is given, or when no format is given and the error
stream is a terminal. An unrecognized explicit value falls back to
the TTY heuristic.
§Arguments
explicit- The value of an explicit--formatflag, if any.is_terminal- Whether the error stream is a TTY.
§Returns
The selected OutputFormat.
Trait Implementations§
Source§impl Clone for OutputFormat
impl Clone for OutputFormat
Source§fn clone(&self) -> OutputFormat
fn clone(&self) -> OutputFormat
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for OutputFormat
Source§impl Debug for OutputFormat
impl Debug for OutputFormat
impl Eq for OutputFormat
Source§impl PartialEq for OutputFormat
impl PartialEq for OutputFormat
Source§fn eq(&self, other: &OutputFormat) -> bool
fn eq(&self, other: &OutputFormat) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for OutputFormat
Auto Trait Implementations§
impl Freeze for OutputFormat
impl RefUnwindSafe for OutputFormat
impl Send for OutputFormat
impl Sync for OutputFormat
impl Unpin for OutputFormat
impl UnsafeUnpin for OutputFormat
impl UnwindSafe for OutputFormat
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.