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

feat(client): Implement TryFrom for Destination #1810

Merged
merged 3 commits into from
May 9, 2019

Conversation

M3rs
Copy link
Contributor

@M3rs M3rs commented May 9, 2019

Add TryFrom impl for Destination, for compiler version >= 1.34.
Add basic unit tests for TryFrom impl

Ref Issue: Implement TryFrom for Destination #1808

M3rs added 2 commits May 8, 2019 18:57
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
Add #[cfg(try_from)] to TryFrom import.

Ref Issue; hyperium#1808
fn try_from(uri: Uri) -> Result<Self, Self::Error> {
uri.authority_part().ok_or(::error::Parse::Uri)?;
uri.scheme_part().ok_or(::error::Parse::Uri)?;
Ok(Destination { uri })
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this can just call Destination::try_from_uri internally.

Change TryFrom<Uri> for Destination to use Destination's
internal try_from_uri method.

Ref Issue: hyperium#1808
Copy link
Member

@seanmonstar seanmonstar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

\o/

@seanmonstar seanmonstar merged commit d1183a8 into hyperium:master May 9, 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

Successfully merging this pull request may close these issues.

2 participants