Skip to content

remove thiserror dependency#633

Merged
yara-blue merged 1 commit intoRustAudio:masterfrom
joseluis:remove-thiserror
Oct 17, 2024
Merged

remove thiserror dependency#633
yara-blue merged 1 commit intoRustAudio:masterfrom
joseluis:remove-thiserror

Conversation

@joseluis
Copy link
Copy Markdown
Contributor

I saw this comment on the commit that added support for Symphonia, regarding it as an unneccesary and cumbersome dependency, which I subscribe 100%, and since it's a simple change I just did it.

@yara-blue
Copy link
Copy Markdown
Member

yara-blue commented Oct 17, 2024

I saw this comment on the commit that added support for Symphonia, regarding it as an unneccesary and cumbersome dependency, which I subscribe 100%, and since it's a simple change I just did it.

Agreed. While I generally love thiserror, rodio is used a lot so a small save in compile time has a big impact all together. LGTM 👍

@yara-blue yara-blue merged commit b394e55 into RustAudio:master Oct 17, 2024
@joseluis joseluis deleted the remove-thiserror branch October 17, 2024 13:49
yara-blue pushed a commit that referenced this pull request Aug 9, 2025
This reverts PR #633 in which thiserror was removed. At the time there
where only two Error types. I expected that number not to increase.
Clearly I was wrong as we now we have 6. Therefore this re-introduces
thiserror.

Note the original argument against this thiserror by est31 in 2021:

> I'm not in favour of adding thiserror, it pulls in a huge set of
dependencies for very little improvement in comfort.

Since then thiserror has become *the* error handling crate for use in
crates (24580 published crates depend on thiserror). The crate most used
for error handling in binaries (anyhow) even relies on thiserror.
Thiserror is also increadibly stable.

Therefore the chance is really quite slim a rodio user will not already
have the right thiserror version somewhere in their dependency tree.
Which means the compile time impact is neglible in most cases.

Gets its own type, it was `Box<dyn Error>` which does not work for
wrapping it in anything requiring `Box<dyn Error + Send + Sync +
'static>`. Unfortunaly making wav_output return a
`Box<dyn Error + Send + Sync + 'static>` will break usage in functions
returning `Box<dyn Error>` (yeah this suprised me too).

This also makes all our errors clonable by swapping Box with Arc and
wrapping non clone errors in an Arc.

Finally I've added a macro (`assert_error_traits`) in `common` to
verify an Error type is Send + Sync + Clone + Debug + Display + 'static.
yara-blue pushed a commit that referenced this pull request Aug 9, 2025
== Thiserror
This reverts PR #633 in which thiserror was removed. At the time there
where only two Error types. I expected that number not to increase.
Clearly I was wrong as we now we have 6. Therefore this re-introduces
thiserror.

Note the original argument against this thiserror by est31 in 2021:

> I'm not in favour of adding thiserror, it pulls in a huge set of
dependencies for very little improvement in comfort.

Since then thiserror has become *the* error handling crate for use in
crates (24580 published crates depend on thiserror). The crate most used
for error handling in binaries (anyhow) even relies on thiserror.
Thiserror is also increadibly stable.

Therefore the chance is really quite slim a rodio user will not already
have the right thiserror version somewhere in their dependency tree.
Which means the compile time impact is neglible in most cases.

== Output to wav
Gets its own type, it was `Box<dyn Error>` which does not work for
wrapping it in anything requiring `Box<dyn Error + Send + Sync +
'static>`. Unfortunaly making wav_output return a
`Box<dyn Error + Send + Sync + 'static>` will break usage in functions
returning `Box<dyn Error>` (yeah this suprised me too).

== Errors Clone
This also makes all our errors clonable by swapping Box with Arc and
wrapping non clone errors in an Arc.

== Errors trait check macro
Finally I've added a macro (`assert_error_traits`) in `common` to
verify an Error type is Send + Sync + Clone + Debug + Display + 'static.
yara-blue pushed a commit that referenced this pull request Aug 9, 2025
== Thiserror
This reverts PR #633 in which thiserror was removed. At the time there
where only two Error types. I expected that number not to increase.
Clearly I was wrong as we now we have 6. Therefore this re-introduces
thiserror.

Note the original argument against this thiserror by est31 in 2021:

> I'm not in favour of adding thiserror, it pulls in a huge set of
dependencies for very little improvement in comfort.

Since then thiserror has become *the* error handling crate for use in
crates (24580 published crates depend on thiserror). The crate most used
for error handling in binaries (anyhow) even relies on thiserror.
Thiserror is also increadibly stable.

Therefore the chance is really quite slim a rodio user will not already
have the right thiserror version somewhere in their dependency tree.
Which means the compile time impact is neglible in most cases.

== Output to wav
Gets its own type, it was `Box<dyn Error>` which does not work for
wrapping it in anything requiring `Box<dyn Error + Send + Sync +
'static>`. Unfortunaly making wav_output return a
`Box<dyn Error + Send + Sync + 'static>` will break usage in functions
returning `Box<dyn Error>` (yeah this suprised me too).

== Errors Clone
This also makes all our errors clonable by swapping Box with Arc and
wrapping non clone errors in an Arc.

== Errors trait check macro
Finally I've added a macro (`assert_error_traits`) in `common` to
verify an Error type is Send + Sync + Clone + Debug + Display + 'static.
yara-blue pushed a commit that referenced this pull request Aug 13, 2025
== Thiserror
This reverts PR #633 in which thiserror was removed. At the time there
where only two Error types. I expected that number not to increase.
Clearly I was wrong as we now we have 6. Therefore this re-introduces
thiserror.

Note the original argument against this thiserror by est31 in 2021:

> I'm not in favour of adding thiserror, it pulls in a huge set of
dependencies for very little improvement in comfort.

Since then thiserror has become *the* error handling crate for use in
crates (24580 published crates depend on thiserror). The crate most used
for error handling in binaries (anyhow) even relies on thiserror.
Thiserror is also increadibly stable.

Therefore the chance is really quite slim a rodio user will not already
have the right thiserror version somewhere in their dependency tree.
Which means the compile time impact is neglible in most cases.

== Output to wav
Gets its own type, it was `Box<dyn Error>` which does not work for
wrapping it in anything requiring `Box<dyn Error + Send + Sync +
'static>`. Unfortunaly making wav_output return a
`Box<dyn Error + Send + Sync + 'static>` will break usage in functions
returning `Box<dyn Error>` (yeah this suprised me too).

== Errors Clone
This also makes all our errors clonable by swapping Box with Arc and
wrapping non clone errors in an Arc.

== Errors trait check macro
Finally I've added a macro (`assert_error_traits`) in `common` to
verify an Error type is Send + Sync + Clone + Debug + Display + 'static.
roderickvd pushed a commit that referenced this pull request Aug 24, 2025
== Thiserror
This reverts PR #633 in which thiserror was removed. At the time there
where only two Error types. I expected that number not to increase.
Clearly I was wrong as we now we have 6. Therefore this re-introduces
thiserror.

Note the original argument against this thiserror by est31 in 2021:

> I'm not in favour of adding thiserror, it pulls in a huge set of
dependencies for very little improvement in comfort.

Since then thiserror has become *the* error handling crate for use in
crates (24580 published crates depend on thiserror). The crate most used
for error handling in binaries (anyhow) even relies on thiserror.
Thiserror is also increadibly stable.

Therefore the chance is really quite slim a rodio user will not already
have the right thiserror version somewhere in their dependency tree.
Which means the compile time impact is neglible in most cases.

== Output to wav
Gets its own type, it was `Box<dyn Error>` which does not work for
wrapping it in anything requiring `Box<dyn Error + Send + Sync +
'static>`. Unfortunaly making wav_output return a
`Box<dyn Error + Send + Sync + 'static>` will break usage in functions
returning `Box<dyn Error>` (yeah this suprised me too).

== Errors Clone
This also makes all our errors clonable by swapping Box with Arc and
wrapping non clone errors in an Arc.

== Errors trait check macro
Finally I've added a macro (`assert_error_traits`) in `common` to
verify an Error type is Send + Sync + Clone + Debug + Display + 'static.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants