|
3 | 3 | use crate::framebuffer::UnknownFramebufferType; |
4 | 4 | use crate::tag::TagHeader; |
5 | 5 | use crate::{ |
6 | | - module, ApmTag, BasicMemoryInfoTag, BootLoaderNameTag, BootdevTag, CommandLineTag, |
| 6 | + ApmTag, BasicMemoryInfoTag, BootLoaderNameTag, BootdevTag, CommandLineTag, |
7 | 7 | EFIBootServicesNotExitedTag, EFIImageHandle32Tag, EFIImageHandle64Tag, EFIMemoryMapTag, |
8 | 8 | EFISdt32Tag, EFISdt64Tag, ElfSectionIter, ElfSectionsTag, EndTag, FramebufferTag, |
9 | 9 | ImageLoadPhysAddrTag, MemoryMapTag, ModuleIter, NetworkTag, RsdpV1Tag, RsdpV2Tag, SmbiosTag, |
10 | | - TagIter, TagType, VBEInfoTag, |
| 10 | + TagIter, TagType, VBEInfoTag, module, |
11 | 11 | }; |
12 | | -use core::error::Error; |
13 | 12 | use core::fmt; |
14 | 13 | use core::mem; |
15 | 14 | use core::ptr::NonNull; |
16 | | -use derive_more::Display; |
17 | 15 | use multiboot2_common::{DynSizedStructure, Header, MaybeDynSized, MemoryError, Tag}; |
| 16 | +use thiserror::Error; |
18 | 17 |
|
19 | 18 | /// Errors that occur when a chunk of memory can't be parsed as |
20 | 19 | /// [`BootInformation`]. |
21 | | -#[derive(Display, Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] |
| 20 | +#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Error)] |
22 | 21 | pub enum LoadError { |
23 | 22 | /// The provided memory can't be parsed as [`BootInformation`]. |
24 | 23 | /// See [`MemoryError`]. |
25 | | - Memory(MemoryError), |
| 24 | + #[error("memory can't be parsed as boot information")] |
| 25 | + Memory(#[source] MemoryError), |
26 | 26 | /// Missing mandatory end tag. |
| 27 | + #[error("missing mandatory end tag")] |
27 | 28 | NoEndTag, |
28 | 29 | } |
29 | 30 |
|
30 | | -impl Error for LoadError { |
31 | | - fn source(&self) -> Option<&(dyn Error + 'static)> { |
32 | | - match self { |
33 | | - Self::Memory(inner) => Some(inner), |
34 | | - Self::NoEndTag => None, |
35 | | - } |
36 | | - } |
37 | | -} |
38 | | - |
39 | 31 | /// The basic header of a [`BootInformation`] as sized Rust type. |
40 | 32 | #[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] |
41 | 33 | #[repr(C, align(8))] |
|
0 commit comments