hyperium / hyper

An HTTP library for Rust
https://hyper.rs
MIT License
14.08k stars 1.55k forks source link

chore: use `Trait` rather than `Into<Box<dyn Trait>>` #3573

Closed wfly1998 closed 4 months ago

wfly1998 commented 4 months ago

All types with Error + Send + Sync can be boxed into Box<dyn Error + Send + Sync>, but using Error ... directly is more flexible and less restrictive for the user.

seanmonstar commented 4 months ago

The way Rust's standard library currently is, the former (Into<...>) is more flexible. That's because Box<dyn Error> does not implement Error, for "reasons".

So, this change makes it so Error = Box<dyn Error> no longer works.

wfly1998 commented 4 months ago

The way Rust's standard library currently is, the former (Into<...>) is more flexible. That's because Box<dyn Error> does not implement Error, for "reasons".

So, this change makes it so Error = Box<dyn Error> no longer works.

Got it, thanks for your answer.