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: more from impls for ServerName and IpAddr #55

Merged
merged 1 commit into from
Sep 22, 2024
Merged

Conversation

nanoqsh
Copy link
Contributor

@nanoqsh nanoqsh commented Sep 22, 2024

Let's add more convenient From impls.

Now instead of:

let name = ServerName::IpAddress(IpAddr::V4(Ipv4Addr::LOCALHOST).into());

You can write:

let name = ServerName::from(Ipv4Addr::LOCALHOST);

Copy link
Member

@djc djc left a comment

Choose a reason for hiding this comment

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

Makes sense to me, thanks!

@djc
Copy link
Member

djc commented Sep 22, 2024

Reminder that while core::net now contains IpAddr et al, that's a relatively recent development as of 1.77.0, which is why, given our MSRV, we still need to duplicate a bunch of stuff here and guard trait impls with std here.

Copy link
Member

@cpu cpu left a comment

Choose a reason for hiding this comment

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

Thank you, this is a nice quality of life boost.

@djc djc added this pull request to the merge queue Sep 22, 2024
Merged via the queue into rustls:main with commit bd6a082 Sep 22, 2024
13 checks passed
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.

3 participants