Skip to content

Macros for creating IPs #1926

@clarfonthey

Description

@clarfonthey

A lot of code uses FromStr to parse IPs in code just because it's more readable to see "2607:f8b0:4009:80b::200e".parse().unwrap() than Ipv6Addr::new(0x2607, 0xf8b0, 0x4009, 0x80b, 0, 0, 0, 0x200e).

Perhaps there could be an ip! macro that would take in a string and parse it into an IP at compile time?

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