mirror of
https://github.com/achanda/ipnetwork.git
synced 2025-06-16 16:58:50 +00:00
Docs update
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
use std::net::Ipv4Addr;
|
||||
|
||||
/// Represents a bunch of errors that can occur while working with a `IpNetwork`
|
||||
#[derive(Debug,Clone,PartialEq,Eq)]
|
||||
pub enum IpNetworkError {
|
||||
InvalidAddr(String),
|
||||
|
@ -6,6 +6,7 @@ use common::{IpNetworkError, cidr_parts, parse_prefix, parse_addr};
|
||||
|
||||
const IPV4_BITS: u8 = 32;
|
||||
|
||||
/// Represents a network range where the IP addresses are of v4
|
||||
#[derive(Debug,Clone,Copy,Hash,PartialEq,Eq)]
|
||||
pub struct Ipv4Network {
|
||||
addr: Ipv4Addr,
|
||||
|
@ -8,6 +8,7 @@ use common::{IpNetworkError, cidr_parts, parse_prefix};
|
||||
const IPV6_BITS: u8 = 128;
|
||||
const IPV6_SEGMENT_BITS: u8 = 16;
|
||||
|
||||
/// Represents a network range where the IP addresses are of v6
|
||||
#[derive(Debug,Clone,Copy,Hash,PartialEq,Eq)]
|
||||
pub struct Ipv6Network {
|
||||
addr: Ipv6Addr,
|
||||
|
@ -1,3 +1,6 @@
|
||||
//! The `ipnetwork` crate provides a set of APIs to work with IP CIDRs in
|
||||
//! Rust. Implementation for IPv4 is more or less stable, IPv6 implementation
|
||||
//! is still WIP.
|
||||
#![cfg_attr(feature = "dev", feature(plugin))]
|
||||
#![cfg_attr(feature = "dev", plugin(clippy))]
|
||||
#![crate_type = "lib"]
|
||||
@ -12,7 +15,8 @@ pub use ipv4::{Ipv4Network, ipv4_mask_to_prefix};
|
||||
pub use ipv6::{Ipv6Network, ipv6_mask_to_prefix};
|
||||
pub use common::IpNetworkError;
|
||||
|
||||
// A network
|
||||
/// Represents a generic network range. This type can have two variants:
|
||||
/// the v4 and the v6 case.
|
||||
#[derive(Debug,Clone,Copy,Hash,PartialEq,Eq)]
|
||||
pub enum IpNetwork {
|
||||
V4(Ipv4Network),
|
||||
|
Reference in New Issue
Block a user