| 1 | //! The errors. |
| 2 | |
| 3 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::{errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std error/, fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/}; |
| 4 | |
| 5 | /// An error. |
| 6 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)] |
| 7 | pub struct Errorrust-analyzer cargo svg 0.18.0 parser/error/Error# { |
| 8 | linerust-analyzer cargo svg 0.18.0 parser/error/Error#line.: usize, |
| 9 | columnrust-analyzer cargo svg 0.18.0 parser/error/Error#column.: usize, |
| 10 | messagerust-analyzer cargo svg 0.18.0 parser/error/Error#message.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, |
| 11 | } |
| 12 | |
| 13 | impl Errorrust-analyzer cargo svg 0.18.0 parser/error/Error# { |
| 14 | /// Create an error. |
| 15 | #[inline] |
| 16 | pub fn newrust-analyzer cargo svg 0.18.0 parser/error/impl#[Error]new().<T: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>>((line, column): (usize, usize), message: T) -> Selfrust-analyzer cargo svg 0.18.0 parser/error/impl#[Error] { |
| 17 | Errorrust-analyzer cargo svg 0.18.0 parser/error/Error# { |
| 18 | linerust-analyzer cargo svg 0.18.0 parser/error/Error#line., |
| 19 | columnrust-analyzer cargo svg 0.18.0 parser/error/Error#column., |
| 20 | messagerust-analyzer cargo svg 0.18.0 parser/error/Error#message.: message.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().(), |
| 21 | } |
| 22 | } |
| 23 | } |
| 24 | |
| 25 | impl errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std error/::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error# for Errorrust-analyzer cargo svg 0.18.0 parser/error/Error# { |
| 26 | #[inline] |
| 27 | fn descriptionrust-analyzer cargo svg 0.18.0 parser/error/impl#[Error][Error]description().(&self) -> &str { |
| 28 | &self.messagerust-analyzer cargo svg 0.18.0 parser/error/Error#message. |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | impl fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for Errorrust-analyzer cargo svg 0.18.0 parser/error/Error# { |
| 33 | fn fmtrust-analyzer cargo svg 0.18.0 parser/error/impl#[Error][Display]fmt().(&self, formatter: &mut fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 34 | if self.linerust-analyzer cargo svg 0.18.0 parser/error/Error#line. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().0 && self.columnrust-analyzer cargo svg 0.18.0 parser/error/Error#column. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().0 { |
| 35 | writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!( |
| 36 | formatter, |
| 37 | "{} (line {}, column {})", |
| 38 | self.messagerust-analyzer cargo svg 0.18.0 parser/error/Error#message., self.linerust-analyzer cargo svg 0.18.0 parser/error/Error#line., self.columnrust-analyzer cargo svg 0.18.0 parser/error/Error#column., |
| 39 | ) |
| 40 | } else if self.linerust-analyzer cargo svg 0.18.0 parser/error/Error#line. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().0 { |
| 41 | writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(formatter, "{} (line {})", self.messagerust-analyzer cargo svg 0.18.0 parser/error/Error#message., self.linerust-analyzer cargo svg 0.18.0 parser/error/Error#line.) |
| 42 | } else { |
| 43 | self.messagerust-analyzer cargo svg 0.18.0 parser/error/Error#message..fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][Display]fmt().(formatter) |
| 44 | } |
| 45 | } |
| 46 | } |