10000 Impl From<Ipv4Addr, Ipv6Addr> for IpAddr. by Yamakaky · Pull Request #38327 · rust-lang/rust · GitHub
[go: up one dir, main page]

Skip to content
8000

Impl From<Ipv4Addr, Ipv6Addr> for IpAddr. #38327

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

Merged
merged 2 commits into from
Jan 7, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Impl From<Ipv4Addr, Ipv6Addr> for IpAddr.
  • Loading branch information
Yamakaky committed Dec 25, 2016
commit 40053a46ff3b5d7a516d1f91e89cd928cf253347
12 changes: 12 additions & 0 deletions src/libstd/net/ip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,18 @@ impl fmt::Display for IpAddr {
}
}

impl From<Ipv4Addr> for IpAddr {
fn from(ipv4: Ipv4Addr) -> IpAddr {
IpAddr::V4(ipv4)
}
}

impl From<Ipv6Addr> for IpAddr {
fn from(ipv6: Ipv6Addr) -> IpAddr {
IpAddr::V6(ipv6)
}
}

#[stable(feature = "rust1", since = "1.0.0")]
impl fmt::Display for Ipv4Addr {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
Expand Down
0