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

Expose Never in public API. #297

Closed
dylanede opened this issue Nov 5, 2019 · 5 comments
Closed

Expose Never in public API. #297

dylanede opened this issue Nov 5, 2019 · 5 comments

Comments

@dylanede
Copy link

dylanede commented Nov 5, 2019

Currently functions returning impl Filter<Extract = ..., Error = warp::never::Never> cannot be written by the user, preventing them from returning irrefutable filters from functions.

@jxs
Copy link
Collaborator

jxs commented Nov 5, 2019

have you tried using futures::never::Never? there's an example which uses it :https://github.com/seanmonstar/warp/blob/master/examples/sse.rs#L3
I think the reason warp uses its own Never type is because Infalible doesn't implement std::error::Error.
hmm but since warp implements Reject for Never crate::never::Nevercan maybe be replaced with futures::never::Never

@taiki-e
Copy link
Contributor

taiki-e commented Nov 5, 2019

I think the reason warp uses its own Never type is because Infalible doesn't implement std::error::Error.

Infalible implements std::error::Error via std::string::ParseError.
rust-lang/futures-rs#1681 (comment)

@jxs
Copy link
Collaborator

jxs commented Nov 5, 2019

ah nice then, thanks @taiki-e! I can submit a PR to address this

@dylanede
Copy link
Author

dylanede commented Nov 5, 2019

@jxs that PR looks like it should solve the problem. Regarding your first suggestion, I can't use a different Never type from warp in the return signature of my function because I am returning the result of warp::any().map(...), which has the error type warp::never::Never.

@jxs
Copy link
Collaborator

jxs commented Nov 7, 2019

resolved with #298

@jxs jxs closed this as completed Nov 7, 2019
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

No branches or pull requests

3 participants