| 1 | /// Enum of different kinds of errors. |
| 2 | #[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:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:)] |
| 3 | pub enum ErrorKindrust-analyzer cargo formatx 0.2.4 error/ErrorKind# { |
| 4 | Parserust-analyzer cargo formatx 0.2.4 error/ErrorKind#Parse#, |
| 5 | MissingValuesrust-analyzer cargo formatx 0.2.4 error/ErrorKind#MissingValues#, |
| 6 | UnsupportedFormatSpecrust-analyzer cargo formatx 0.2.4 error/ErrorKind#UnsupportedFormatSpec#, |
| 7 | } |
| 8 | |
| 9 | /// Error struct which implements [Error](std::error::Error) trait. |
| 10 | #[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:)] |
| 11 | pub struct Errorrust-analyzer cargo formatx 0.2.4 error/Error# { |
| 12 | messagerust-analyzer cargo formatx 0.2.4 error/Error#message.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, |
| 13 | kindrust-analyzer cargo formatx 0.2.4 error/Error#kind.: ErrorKindrust-analyzer cargo formatx 0.2.4 error/ErrorKind#, |
| 14 | } |
| 15 | |
| 16 | impl stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::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 formatx 0.2.4 error/Error# { |
| 17 | fn fmtrust-analyzer cargo formatx 0.2.4 error/impl#[Error][Display]fmt().(&self, f: &mut stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::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#<'_>) -> stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::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# { |
| 18 | writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "{}", self.messagerust-analyzer cargo formatx 0.2.4 error/Error#message.) |
| 19 | } |
| 20 | } |
| 21 | |
| 22 | impl 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/::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error# for Errorrust-analyzer cargo formatx 0.2.4 error/Error# {} |
| 23 | |
| 24 | impl Errorrust-analyzer cargo formatx 0.2.4 error/Error# { |
| 25 | /// Create new parse error. |
| 26 | pub(craterust-analyzer cargo formatx 0.2.4 crate/) fn new_parserust-analyzer cargo formatx 0.2.4 error/impl#[Error]new_parse().(message: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#) -> Selfrust-analyzer cargo formatx 0.2.4 error/impl#[Error] { |
| 27 | Selfrust-analyzer cargo formatx 0.2.4 error/impl#[Error] { |
| 28 | messagerust-analyzer cargo formatx 0.2.4 error/Error#message., |
| 29 | kindrust-analyzer cargo formatx 0.2.4 error/Error#kind.: ErrorKindrust-analyzer cargo formatx 0.2.4 error/ErrorKind#::Parserust-analyzer cargo formatx 0.2.4 error/ErrorKind#Parse#, |
| 30 | } |
| 31 | } |
| 32 | |
| 33 | /// Create new missing values error. |
| 34 | pub(craterust-analyzer cargo formatx 0.2.4 crate/) fn new_valuesrust-analyzer cargo formatx 0.2.4 error/impl#[Error]new_values().(message: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#) -> Selfrust-analyzer cargo formatx 0.2.4 error/impl#[Error] { |
| 35 | Selfrust-analyzer cargo formatx 0.2.4 error/impl#[Error] { |
| 36 | messagerust-analyzer cargo formatx 0.2.4 error/Error#message., |
| 37 | kindrust-analyzer cargo formatx 0.2.4 error/Error#kind.: ErrorKindrust-analyzer cargo formatx 0.2.4 error/ErrorKind#::MissingValuesrust-analyzer cargo formatx 0.2.4 error/ErrorKind#MissingValues#, |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | /// Create new unsupported format spec error. |
| 42 | pub(craterust-analyzer cargo formatx 0.2.4 crate/) fn new_ufsrust-analyzer cargo formatx 0.2.4 error/impl#[Error]new_ufs().(message: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#) -> Selfrust-analyzer cargo formatx 0.2.4 error/impl#[Error] { |
| 43 | Selfrust-analyzer cargo formatx 0.2.4 error/impl#[Error] { |
| 44 | messagerust-analyzer cargo formatx 0.2.4 error/Error#message., |
| 45 | kindrust-analyzer cargo formatx 0.2.4 error/Error#kind.: ErrorKindrust-analyzer cargo formatx 0.2.4 error/ErrorKind#::UnsupportedFormatSpecrust-analyzer cargo formatx 0.2.4 error/ErrorKind#UnsupportedFormatSpec#, |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | /// Returns error message. |
| 50 | pub fn messagerust-analyzer cargo formatx 0.2.4 error/impl#[Error]message().(&self) -> Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# { |
| 51 | self.messagerust-analyzer cargo formatx 0.2.4 error/Error#message..clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][Clone]clone().() |
| 52 | } |
| 53 | |
| 54 | /// Returns `ErrorKind` |
| 55 | pub fn kindrust-analyzer cargo formatx 0.2.4 error/impl#[Error]kind().(&self) -> ErrorKindrust-analyzer cargo formatx 0.2.4 error/ErrorKind# { |
| 56 | self.kindrust-analyzer cargo formatx 0.2.4 error/Error#kind..clonerust-analyzer cargo formatx 0.2.4 error/impl#[ErrorKind][Clone]clone().() |
| 57 | } |
| 58 | } |