Struct netsim::Ipv4Range [] [src]

pub struct Ipv4Range { /* fields omitted */ }

A range of IPv4 addresses with a common prefix

Methods

impl Ipv4Range
[src]

[src]

Create an IPv4 range with the given base address and netmask prefix length.

Example

Create the subnet 192.168.0.0/24 with Ipv4Range::new(ipv4!("192.168.0.0"), 24)

[src]

Return the entire IPv4 range, eg. 0.0.0.0/0

[src]

Returns the local network subnet 10.0.0.0/8

[src]

Returns a local network subnet 172.(16 | x).0.0/16 where x is a 4-bit number given by block

Panics

If block & 0xf0 != 0

[src]

Returns the local subnet 192.168.x.0/24 where x is given by block.

[src]

Returns a random local network subnet from one of the ranges 10.0.0.0, 172.16.0.0 or 192.168.0.0

[src]

Get the netmask as an IP address

[src]

Get the number of netmask prefix bits

[src]

Get the base address of the range, ie. the lowest IP address which is part of the range.

[src]

Get a default IP address for the range's gateway. This is one higher than the base address of the range. eg. for 10.0.0.0/8, the default address for the gateway will be 10.0.0.1

[src]

Get a random IP address from the range which is not the base address or the default for the gateway address.

[src]

Check whether this range contains the given IP address

Important traits for Vec<u8>
[src]

Split a range into num sub-ranges

Panics

If the range is too small to be split up that much.

Trait Implementations

impl Clone for Ipv4Range
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Copy for Ipv4Range
[src]

impl Debug for Ipv4Range
[src]

[src]

Formats the value using the given formatter. Read more

impl FromStr for Ipv4Range
[src]

The associated error which can be returned from parsing.

[src]

Parses a string s to return a value of this type. Read more

Auto Trait Implementations

impl Send for Ipv4Range

impl Sync for Ipv4Range