| 1 | use anyhowrust-analyzer cargo anyhow 1.0.104 crate/::anyhowrust-analyzer cargo anyhow 1.0.104 macros/anyhow!; |
| 2 | |
| 3 | /// An error to do with data collection. |
| 4 | #[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:)] |
| 5 | pub enum CollectionErrorrust-analyzer cargo bottom 0.14.9 collection/error/CollectionError# { |
| 6 | /// A general error to propagate back up. A wrapper around |
| 7 | /// [`anyhow::Error`]. |
| 8 | Generalrust-analyzer cargo bottom 0.14.9 collection/error/CollectionError#General#(anyhowrust-analyzer cargo anyhow 1.0.104 crate/::Errorrust-analyzer cargo anyhow 1.0.104 Error#), |
| 9 | |
| 10 | /// The collection is unsupported. |
| 11 | #[allow( |
| 12 | dead_code, |
| 13 | reason = "this is not used if everything is supported for the platform" |
| 14 | )] |
| 15 | Unsupportedrust-analyzer cargo bottom 0.14.9 collection/error/CollectionError#Unsupported#, |
| 16 | } |
| 17 | |
| 18 | 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 CollectionErrorrust-analyzer cargo bottom 0.14.9 collection/error/CollectionError# { |
| 19 | fn fmtrust-analyzer cargo bottom 0.14.9 collection/error/impl#[CollectionError][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# { |
| 20 | match self { |
| 21 | CollectionErrorrust-analyzer cargo bottom 0.14.9 collection/error/CollectionError#::Generalrust-analyzer cargo bottom 0.14.9 collection/error/CollectionError#General#(err) => err.fmtrust-analyzer cargo anyhow 1.0.104 error/impl#[Error][Display]fmt().(f), |
| 22 | CollectionErrorrust-analyzer cargo bottom 0.14.9 collection/error/CollectionError#::Unsupportedrust-analyzer cargo bottom 0.14.9 collection/error/CollectionError#Unsupported# => { |
| 23 | writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!( |
| 24 | f, |
| 25 | "bottom does not support this type of data collection for this platform." |
| 26 | ) |
| 27 | } |
| 28 | } |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | 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 CollectionErrorrust-analyzer cargo bottom 0.14.9 collection/error/CollectionError# {} |
| 33 | |
| 34 | /// A [`Result`] with the error type being a [`DataCollectionError`]. |
| 35 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) type CollectionResultrust-analyzer cargo bottom 0.14.9 collection/error/CollectionResult#<T> = Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<T, CollectionErrorrust-analyzer cargo bottom 0.14.9 collection/error/CollectionError#>; |
| 36 | |
| 37 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#> for CollectionErrorrust-analyzer cargo bottom 0.14.9 collection/error/CollectionError# { |
| 38 | fn fromrust-analyzer cargo bottom 0.14.9 collection/error/impl#[CollectionError][`From<std::io::Error>`]from().(err: stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#) -> Selfrust-analyzer cargo bottom 0.14.9 collection/error/impl#[CollectionError][`From<std::io::Error>`] { |
| 39 | Selfrust-analyzer cargo bottom 0.14.9 collection/error/impl#[CollectionError][`From<std::io::Error>`]::Generalrust-analyzer cargo bottom 0.14.9 collection/error/CollectionError#General#(err.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()) |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<&'static str> for CollectionErrorrust-analyzer cargo bottom 0.14.9 collection/error/CollectionError# { |
| 44 | fn fromrust-analyzer cargo bottom 0.14.9 collection/error/impl#[CollectionError][`From<&'static str>`]from().(msg: &'static str) -> Selfrust-analyzer cargo bottom 0.14.9 collection/error/impl#[CollectionError][`From<&'static str>`] { |
| 45 | Selfrust-analyzer cargo bottom 0.14.9 collection/error/impl#[CollectionError][`From<&'static str>`]::Generalrust-analyzer cargo bottom 0.14.9 collection/error/CollectionError#General#(anyhowrust-analyzer cargo anyhow 1.0.104 macros/anyhow!!(msg)) |
| 46 | } |
| 47 | } |