Skip to content

Un-deprecate IpAddr #1451

Closed
Closed
@canndrew

Description

@canndrew

The IpAddr type recently got deprecated from the standard library.

This means libstd now has:

  • A type for (ipv4 address, port) pairs: SocketAddrV4
  • A type for (ipv6 address, port) pairs: SocketAddrV6
  • A type for (ip address, port) pairs: SocketAddr
  • A type for ipv4 addresses: Ipv4Addr
  • A type for ipv6 addresses: Ipv6Addr
  • But not a type for ip addresses: IpAddr

This is silly. IpAddr fits in perfectly with the other types here. It's useful to be able to decompose a SocketAddr into IpAddr and port components and to build one out of these components. It we're going to remove IpAddr then shouldn't SocketAddr be removed aswell? It's very odd to not have a type for generic IP addresses but to have one for generic IP address + port.

There's also at least one place in the standard library itself where IpAddr is needed. The lookup_host function returns an iterator of SocketAddrs with a dummy port because it doesn't have IP address type to use.

The deprecation notice describes IpAddr as being "too small to pull it's weight". Isn't being small a good thing? A type that only takes up a few lines of code doesn't come with much maintainance burden. Surely it's large, complicated types that implement specialised functionality that deserve to be spun off into their own libraries?

Can we just put IpAddr back?

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-libs-apiRelevant to the library API team, which will review and decide on the RFC.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions