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

Implement TryFrom for Destination #1808

Closed
seanmonstar opened this issue May 6, 2019 · 2 comments
Closed

Implement TryFrom for Destination #1808

seanmonstar opened this issue May 6, 2019 · 2 comments
Labels
A-client Area: client. C-feature Category: feature. This is adding a new feature. E-easy Effort: easy. A task that would be a great starting point for a new contributor.

Comments

@seanmonstar
Copy link
Member

With TryFrom now stable, we can provide a TryFrom<Uri> for Destination. To prevent requiring the new Rust compiler, this can include a #[cfg] attribute that is set in the build.rs.

@seanmonstar seanmonstar added A-client Area: client. E-easy Effort: easy. A task that would be a great starting point for a new contributor. C-feature Category: feature. This is adding a new feature. labels May 6, 2019
@M3rs
Copy link
Contributor

M3rs commented May 8, 2019

I'd like to give this a shot. I think I have the implementation working, but I don't know a lot about #[cfg] in built.rs.

@seanmonstar
Copy link
Member Author

Similar to how it's currently checking for Rust 1.30, and if found, printing cargo:rustc-cfg=error_source, a new check can be added for Rust 1.34, and if found, print cargo:rustc-cfg=try_from. Then add the #[cfg(try_from)] attribute to the impl TryFrom<Uri> for Destination.

When doing so, it'd be best to only call version().unwrap() once, since that's invoking a child process to run rustc -V...

M3rs added a commit to M3rs/hyper that referenced this issue May 8, 2019
Add TryFrom<Uri> impl for Destination, for compiler version >= 1.34.
Add basic unit tests for TryFrom impl

Ref Issue: Implement TryFrom for Destination hyperium#1808
M3rs added a commit to M3rs/hyper that referenced this issue May 9, 2019
Add #[cfg(try_from)] to TryFrom import.

Ref Issue; hyperium#1808
M3rs added a commit to M3rs/hyper that referenced this issue May 9, 2019
Change TryFrom<Uri> for Destination to use Destination's
internal try_from_uri method.

Ref Issue: hyperium#1808
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-client Area: client. C-feature Category: feature. This is adding a new feature. E-easy Effort: easy. A task that would be a great starting point for a new contributor.
Projects
None yet
Development

No branches or pull requests

2 participants