Skip to content

Commit

Permalink
Make all error enums Clone
Browse files Browse the repository at this point in the history
  • Loading branch information
abey79 committed Nov 2, 2024
1 parent f43d36e commit 76bf43f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Unreleased

- All error enums are now `Clone`.

# Version 0.15.3 (2024-03-04)

- Add `try_with_sample_rate`, a non-panicking variant of `with_sample_rate`.
Expand Down
4 changes: 2 additions & 2 deletions asio-sys/src/bindings/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ use std::error::Error;
use std::fmt;

/// Errors that might occur during `Asio::load_driver`.
#[derive(Debug)]
#[derive(Clone, Debug)]
pub enum LoadDriverError {
LoadDriverFailed,
DriverAlreadyExists,
InitializationFailed(AsioError),
}

/// General errors returned by ASIO.
#[derive(Debug)]
#[derive(Clone, Debug)]
pub enum AsioError {
NoDrivers,
HardwareMalfunction,
Expand Down
12 changes: 6 additions & 6 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ impl From<BackendSpecificError> for DeviceNameError {
}

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

/// May occur when attempting to request the default input or output stream format from a [`Device`](crate::Device).
#[derive(Debug)]
#[derive(Clone, Debug)]
pub enum DefaultStreamConfigError {
/// The device no longer exists. This can happen if the device is disconnected while the
/// program is running.
Expand Down Expand Up @@ -152,7 +152,7 @@ impl From<BackendSpecificError> for DefaultStreamConfigError {
}
}
/// Error that can happen when creating a [`Stream`](crate::Stream).
#[derive(Debug)]
#[derive(Clone, Debug)]
pub enum BuildStreamError {
/// The device no longer exists. This can happen if the device is disconnected while the
/// program is running.
Expand Down Expand Up @@ -203,7 +203,7 @@ impl From<BackendSpecificError> for BuildStreamError {
/// As of writing this, only macOS may immediately return an error while calling this method. This
/// is because both the alsa and wasapi backends only enqueue these commands and do not process
/// them immediately.
#[derive(Debug)]
#[derive(Clone, Debug)]
pub enum PlayStreamError {
/// The device associated with the stream is no longer available.
DeviceNotAvailable,
Expand Down Expand Up @@ -235,7 +235,7 @@ impl From<BackendSpecificError> for PlayStreamError {
/// As of writing this, only macOS may immediately return an error while calling this method. This
/// is because both the alsa and wasapi backends only enqueue these commands and do not process
/// them immediately.
#[derive(Debug)]
#[derive(Clone, Debug)]
pub enum PauseStreamError {
/// The device associated with the stream is no longer available.
DeviceNotAvailable,
Expand Down Expand Up @@ -263,7 +263,7 @@ impl From<BackendSpecificError> for PauseStreamError {
}

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

0 comments on commit 76bf43f

Please sign in to comment.