Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make all error enums Clone #924

Merged
merged 1 commit into from
Nov 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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