Skip to content

Wrong assertion message and comment #64

@YichiZhang0613

Description

@YichiZhang0613

In ipnet-master/src/ipnet.rs, the assertion message and comment of following 2 functions: "less then or equal to 32" and "less then or equal to 128" should be "less than or equal to 32" and "less than or equal to 128" respectively.

/// Creates a new IPv4 network address from an `Ipv4Addr` and prefix
    /// length. If called from a const context it will verify prefix length
    /// at compile time. Otherwise it will panic at runtime if prefix length
    /// is not less then or equal to 32.
...
pub const fn new_assert(ip: Ipv4Addr, prefix_len: u8) -> Ipv4Net {
        assert!(prefix_len <= 32, "PREFIX_LEN must be less then or equal to 32 for Ipv4Net");
        Ipv4Net { addr: ip, prefix_len: prefix_len }
    }
/// Creates a new IPv6 network address from an `Ipv6Addr` and prefix
    /// length. If called from a const context it will verify prefix length
    /// at compile time. Otherwise it will panic at runtime if prefix length
    /// is not less then or equal to 128.
...
    pub const fn new_assert(ip: Ipv6Addr, prefix_len: u8) -> Ipv6Net {
        assert!(prefix_len <= 128, "PREFIX_LEN must be less then or equal to 128 for Ipv6Net");
        Ipv6Net { addr: ip, prefix_len: prefix_len }
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions