mirror of
https://github.com/achanda/ipnetwork.git
synced 2025-06-19 10:06:44 +00:00
Add Serde Feature for IpNetwork
This commit is contained in:
@ -8,6 +8,12 @@
|
||||
#![crate_type = "lib"]
|
||||
#![doc(html_root_url = "https://docs.rs/ipnetwork/0.12.7")]
|
||||
|
||||
#[cfg(feature = "with-serde")]
|
||||
extern crate serde;
|
||||
#[cfg(feature = "with-serde")]
|
||||
#[macro_use]
|
||||
extern crate serde_derive;
|
||||
|
||||
use std::fmt;
|
||||
use std::net::IpAddr;
|
||||
|
||||
@ -23,6 +29,7 @@ pub use common::IpNetworkError;
|
||||
|
||||
/// Represents a generic network range. This type can have two variants:
|
||||
/// the v4 and the v6 case.
|
||||
#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
|
||||
#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq, PartialOrd, Ord)]
|
||||
pub enum IpNetwork {
|
||||
V4(Ipv4Network),
|
||||
|
Reference in New Issue
Block a user