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

Is it possible to go back to an Box<dny Error>? #10

Closed
MaikKlein opened this issue Oct 8, 2019 · 1 comment · Fixed by #12
Closed

Is it possible to go back to an Box<dny Error>? #10

MaikKlein opened this issue Oct 8, 2019 · 1 comment · Fixed by #12

Comments

@MaikKlein
Copy link

I am currently looking at https://docs.rs/tower-hyper/0.1.1/tower_hyper/server/struct.Server.html which has the following trait bound S::Error: Into<Box<dyn Error + Send + Sync>>,

Is there currently a way to converting back to a Box<dyn Error + Send + Sync>? I have briefly looked at the implementation and it seems we would need to implement Error for ErrorImpl.

Then we could do something like

impl Into<Box<dyn StdError + Send + Sync + 'static>> for Error {
    fn into(self) -> Box<dyn StdError + Send + Sync + 'static> {
        Box::new(self.inner)
    }
}

The problem is that the type was thrown away, and it is unclear to me how it should be implemented.

Any ideas?

@dtolnay
Copy link
Owner

dtolnay commented Oct 8, 2019

I published 1.0.5 with this impl.

impl From<Error> for Box<dyn StdError + Send + Sync + '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 a pull request may close this issue.

2 participants