IpNet

Trait IpNet 

Source
pub trait IpNet:
    ToNetwork<Self>
    + Debug
    + Ord
    + Copy
where Self: Sized,
{ type S: TraverseState<Net = Self>; type I: Iterator<Item = bool>; // Required methods fn prefix_bits(&self) -> Self::I; fn prefix_len(&self) -> u8; fn with_new_prefix(&self, len: u8) -> Self; }
Expand description

An abstraction for IP networks.

Required Associated Types§

Source

type S: TraverseState<Net = Self>

Used for internal traversing.

Source

type I: Iterator<Item = bool>

I is an iterator to the prefix bits of the network.

Required Methods§

Source

fn prefix_bits(&self) -> Self::I

Returns the iterator to the prefix bits of the network.

Source

fn prefix_len(&self) -> u8

Returns the prefix length.

Source

fn with_new_prefix(&self, len: u8) -> Self

Returns a copy of the network with the address truncated to the given length.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl IpNet for Ipv4Net

Source§

type S = Ipv4TraverseState

Source§

type I = Ipv4PrefixBitIterator

Source§

fn prefix_bits(&self) -> Self::I

Source§

fn prefix_len(&self) -> u8

Source§

fn with_new_prefix(&self, len: u8) -> Self

Source§

impl IpNet for Ipv6Net

Source§

type S = Ipv6TraverseState

Source§

type I = Ipv6PrefixBitIterator

Source§

fn prefix_bits(&self) -> Self::I

Source§

fn prefix_len(&self) -> u8

Source§

fn with_new_prefix(&self, len: u8) -> Self

Implementors§