Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ default = ["std"]
no_unsafe = []
std = []
bitstring = ["dep:bitstring"]
jsonschema = ["dep:schemars"]
serde = ["dep:serde"]

[dependencies]
bitstring = { version = "0.2.0", optional = true, features = ["net"] }
schemars = { version = "1.2", optional = true }
serde = { version = "1.0.210", optional = true, default-features = false }

[dev-dependencies]
Expand Down
1 change: 1 addition & 0 deletions src/cidr/any.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ use crate::{
///
/// [`Cidr`]: crate::Cidr
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
#[cfg_attr(feature = "jsonschema", derive(schemars::JsonSchema))]
pub enum AnyIpCidr {
/// "any" network containing all IPv4 and IPv6 addresses
Any,
Expand Down
3 changes: 3 additions & 0 deletions src/cidr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ use core::net::{
///
/// [`Cidr`]: crate::Cidr
#[derive(Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "jsonschema", derive(schemars::JsonSchema))]
pub struct Ipv4Cidr {
pub(crate) address: Ipv4Addr,
pub(crate) network_length: u8,
Expand All @@ -33,6 +34,7 @@ pub struct Ipv4Cidr {
///
/// [`Cidr`]: crate::Cidr
#[derive(Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "jsonschema", derive(schemars::JsonSchema))]
pub struct Ipv6Cidr {
pub(crate) address: Ipv6Addr,
pub(crate) network_length: u8,
Expand All @@ -42,6 +44,7 @@ pub struct Ipv6Cidr {
///
/// [`Cidr`]: crate::Cidr
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
#[cfg_attr(feature = "jsonschema", derive(schemars::JsonSchema))]
pub enum IpCidr {
/// IPv4 network
V4(Ipv4Cidr),
Expand Down