pub enum FormatError {
SyntaxError {
message: &'static str,
},
RangeError {
input: TextRange,
tree: TextRange,
},
InvalidDocument(InvalidDocumentError),
PoorLayout,
}Expand description
Series of errors encountered during formatting
Variants§
SyntaxError
In case a node can’t be formatted because it either misses a require child element or a child is present that should not (e.g. a trailing comma after a rest element).
RangeError
In case range formatting failed because the provided range was larger than the formatted syntax tree
InvalidDocument(InvalidDocumentError)
In case printing the document failed because it has an invalid structure.
PoorLayout
Formatting failed because some content encountered a situation where a layout
choice by an enclosing crate::Format resulted in a poor layout for a child crate::Format.
It’s up to an enclosing crate::Format to handle the error and pick another layout.
This error should not be raised if there’s no outer crate::Format handling the poor layout error,
avoiding that formatting of the whole document fails.
Implementations§
Source§impl FormatError
impl FormatError
pub fn syntax_error(message: &'static str) -> Self
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 moreimpl Copy for FormatError
Source§impl Debug for FormatError
impl Debug for FormatError
Source§impl Display for FormatError
impl Display for FormatError
impl Eq for FormatError
Source§impl Error for FormatError
impl Error for FormatError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<&PrintError> for FormatError
impl From<&PrintError> for FormatError
Source§fn from(error: &PrintError) -> Self
fn from(error: &PrintError) -> Self
Source§impl From<PrintError> for FormatError
impl From<PrintError> for FormatError
Source§fn from(error: PrintError) -> Self
fn from(error: PrintError) -> Self
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,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> 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 moreSource§impl<T> ToCharString for Twhere
T: Display,
impl<T> ToCharString for Twhere
T: Display,
Source§fn try_to_char_string(&self) -> Result<CharString, ToCharStringError>
fn try_to_char_string(&self) -> Result<CharString, ToCharStringError>
CharString. Read moreSource§fn to_char_string(&self) -> CharString
fn to_char_string(&self) -> CharString
CharString. Read more