Skip to content

Commit ca77d84

Browse files
authored
Make all error enums Clone (#924)
1 parent f43d36e commit ca77d84

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

CHANGELOG.md

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

3+
- All error enums are now `Clone`.
4+
35
# Version 0.15.3 (2024-03-04)
46

57
- Add `try_with_sample_rate`, a non-panicking variant of `with_sample_rate`.

asio-sys/src/bindings/errors.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ use std::error::Error;
22
use std::fmt;
33

44
/// Errors that might occur during `Asio::load_driver`.
5-
#[derive(Debug)]
5+
#[derive(Clone, Debug)]
66
pub enum LoadDriverError {
77
LoadDriverFailed,
88
DriverAlreadyExists,
99
InitializationFailed(AsioError),
1010
}
1111

1212
/// General errors returned by ASIO.
13-
#[derive(Debug)]
13+
#[derive(Clone, Debug)]
1414
pub enum AsioError {
1515
NoDrivers,
1616
HardwareMalfunction,

src/error.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ impl From<BackendSpecificError> for DeviceNameError {
8989
}
9090

9191
/// Error that can happen when enumerating the list of supported formats.
92-
#[derive(Debug)]
92+
#[derive(Clone, Debug)]
9393
pub enum SupportedStreamConfigsError {
9494
/// The device no longer exists. This can happen if the device is disconnected while the
9595
/// program is running.
@@ -119,7 +119,7 @@ impl From<BackendSpecificError> for SupportedStreamConfigsError {
119119
}
120120

121121
/// May occur when attempting to request the default input or output stream format from a [`Device`](crate::Device).
122-
#[derive(Debug)]
122+
#[derive(Clone, Debug)]
123123
pub enum DefaultStreamConfigError {
124124
/// The device no longer exists. This can happen if the device is disconnected while the
125125
/// program is running.
@@ -152,7 +152,7 @@ impl From<BackendSpecificError> for DefaultStreamConfigError {
152152
}
153153
}
154154
/// Error that can happen when creating a [`Stream`](crate::Stream).
155-
#[derive(Debug)]
155+
#[derive(Clone, Debug)]
156156
pub enum BuildStreamError {
157157
/// The device no longer exists. This can happen if the device is disconnected while the
158158
/// program is running.
@@ -203,7 +203,7 @@ impl From<BackendSpecificError> for BuildStreamError {
203203
/// As of writing this, only macOS may immediately return an error while calling this method. This
204204
/// is because both the alsa and wasapi backends only enqueue these commands and do not process
205205
/// them immediately.
206-
#[derive(Debug)]
206+
#[derive(Clone, Debug)]
207207
pub enum PlayStreamError {
208208
/// The device associated with the stream is no longer available.
209209
DeviceNotAvailable,
@@ -235,7 +235,7 @@ impl From<BackendSpecificError> for PlayStreamError {
235235
/// As of writing this, only macOS may immediately return an error while calling this method. This
236236
/// is because both the alsa and wasapi backends only enqueue these commands and do not process
237237
/// them immediately.
238-
#[derive(Debug)]
238+
#[derive(Clone, Debug)]
239239
pub enum PauseStreamError {
240240
/// The device associated with the stream is no longer available.
241241
DeviceNotAvailable,
@@ -263,7 +263,7 @@ impl From<BackendSpecificError> for PauseStreamError {
263263
}
264264

265265
/// Errors that might occur while a stream is running.
266-
#[derive(Debug)]
266+
#[derive(Clone, Debug)]
267267
pub enum StreamError {
268268
/// The device no longer exists. This can happen if the device is disconnected while the
269269
/// program is running.

0 commit comments

Comments
 (0)