mirror of
https://github.com/achanda/ipnetwork.git
synced 2025-06-17 01:08:53 +00:00
WARNING: src/lib.rs - IpNetwork::mask (line 83) Code block is not currently run as a test, but will in future versions of rustdoc. Please ensure this code block is a runnable test, or use the ignore
directive.
This commit is contained in:
@ -79,6 +79,7 @@ impl IpNetwork {
|
|||||||
/// That means the `prefix` most significant bits will be 1 and the rest 0
|
/// That means the `prefix` most significant bits will be 1 and the rest 0
|
||||||
///
|
///
|
||||||
/// # Example
|
/// # Example
|
||||||
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// use ipnetwork::IpNetwork;
|
/// use ipnetwork::IpNetwork;
|
||||||
/// use std::net::{Ipv4Addr, Ipv6Addr};
|
/// use std::net::{Ipv4Addr, Ipv6Addr};
|
||||||
@ -92,7 +93,7 @@ impl IpNetwork {
|
|||||||
/// assert_eq!(v6_net.mask(), Ipv6Addr::new(0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff));
|
/// assert_eq!(v6_net.mask(), Ipv6Addr::new(0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff));
|
||||||
/// let v6_net: IpNetwork = "ff01::0/32".parse().unwrap();
|
/// let v6_net: IpNetwork = "ff01::0/32".parse().unwrap();
|
||||||
/// assert_eq!(v6_net.mask(), Ipv6Addr::new(0xffff, 0xffff, 0, 0, 0, 0, 0, 0));
|
/// assert_eq!(v6_net.mask(), Ipv6Addr::new(0xffff, 0xffff, 0, 0, 0, 0, 0, 0));
|
||||||
///```
|
/// ```
|
||||||
pub fn mask(&self) -> IpAddr {
|
pub fn mask(&self) -> IpAddr {
|
||||||
match *self {
|
match *self {
|
||||||
IpNetwork::V4(ref a) => IpAddr::V4(a.mask()),
|
IpNetwork::V4(ref a) => IpAddr::V4(a.mask()),
|
||||||
|
Reference in New Issue
Block a user