Skip to main content

ip_mask_to_prefix_checked

Function ip_mask_to_prefix_checked 

Source
pub const fn ip_mask_to_prefix_checked(mask: IpAddr) -> Option<u8>
Expand description

Converts a IpAddr network mask into a prefix.

If the mask is invalid this will return None. This is useful in const contexts where Option::unwrap may be called to trigger a compile-time error if the prefix is invalid.