Skip to content

Commit 9412ca2

Browse files
gpt_disk_io: Unconditionally implement the Error trait
1 parent 2f731ff commit 9412ca2

File tree

6 files changed

+13
-27
lines changed

6 files changed

+13
-27
lines changed

gpt_disk_io/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Unreleased
22

33
* MSRV increased to 1.81.
4+
* The `Error` trait is now unconditionally implemented for all error types.
45

56
# 0.16.1
67

gpt_disk_io/README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ See also the [`gpt_disk_types`] package.
1313

1414
## Features
1515

16-
* `std`: Enables the `StdBlockIo` type, as well as `std::error::Error`
17-
implementations for all of the error types. Off by default.
16+
No features are enabled by default.
17+
18+
* `alloc`: Enables `Vec` implementation of `BlockIoAdapter`.
19+
* `std`: Enables `std::io` implementations of `BlockIoAdapter`.
1820

1921
## Minimum Supported Rust Version (MSRV)
2022

gpt_disk_io/src/block_io/slice_block_io.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,6 @@ use gpt_disk_types::{BlockSize, Lba};
1515
use alloc::vec::Vec;
1616

1717
/// Error type used for `&[u8]` and `&mut [u8]` versions of [`BlockIoAdapter`].
18-
///
19-
/// If the `std` feature is enabled, this type implements the [`Error`]
20-
/// trait.
21-
///
22-
/// [`Error`]: std::error::Error
2318
#[allow(clippy::module_name_repetitions)]
2419
#[derive(Clone, Copy, Debug, Default, Eq, PartialEq, Hash, Ord, PartialOrd)]
2520
pub enum SliceBlockIoError {
@@ -60,6 +55,8 @@ impl Display for SliceBlockIoError {
6055
}
6156
}
6257

58+
impl core::error::Error for SliceBlockIoError {}
59+
6360
#[track_caller]
6461
fn buffer_byte_range_opt(
6562
block_size: BlockSize,

gpt_disk_io/src/disk.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,11 @@ where
146146
}
147147
}
148148

149+
impl<IoError> core::error::Error for DiskError<IoError> where
150+
IoError: Debug + Display
151+
{
152+
}
153+
149154
/// Read and write GPT disk data.
150155
///
151156
/// The disk is accessed via an object implementing the [`BlockIo`]

gpt_disk_io/src/lib.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@
2222
//! # Features
2323
//!
2424
//! * `alloc`: Enables [`Vec`] implementation of [`BlockIoAdapter`].
25-
//! * `std`: Enables [`std::io`] implementations of [`BlockIoAdapter`],
26-
//! as well as `std::error::Error` implementations for all of the
27-
//! error types. Off by default.
25+
//! * `std`: Enables [`std::io`] implementations of [`BlockIoAdapter`].
2826
//!
2927
//! # Examples
3028
//!
@@ -136,8 +134,6 @@ extern crate alloc;
136134

137135
mod block_io;
138136
mod disk;
139-
#[cfg(feature = "std")]
140-
mod std_support;
141137

142138
// Re-export dependencies.
143139
pub use gpt_disk_types;

gpt_disk_io/src/std_support.rs

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)