Use proxmox-serde instead, which contains macros to do the same stuff. The main use-case here is to generate Serialize and Deserialize impls from the FromStr and Display implementations.
Signed-off-by: Gabriel Goller <g.gol...@proxmox.com> --- Cargo.toml | 2 +- proxmox-sdn-types/Cargo.toml | 3 +-- proxmox-sdn-types/debian/control | 16 ++++++---------- proxmox-sdn-types/src/area.rs | 8 ++++---- proxmox-ve-config/Cargo.toml | 4 +--- proxmox-ve-config/debian/control | 9 ++------- proxmox-ve-config/src/firewall/types/address.rs | 5 +++-- proxmox-ve-config/src/firewall/types/alias.rs | 6 ++++-- proxmox-ve-config/src/firewall/types/ipset.rs | 5 +++-- proxmox-ve-config/src/firewall/types/log.rs | 2 +- proxmox-ve-config/src/firewall/types/port.rs | 5 +++-- proxmox-ve-config/src/firewall/types/rule.rs | 4 ++-- proxmox-ve-config/src/guest/types.rs | 8 ++++---- proxmox-ve-config/src/guest/vm.rs | 13 +++++++++---- proxmox-ve-config/src/sdn/config.rs | 14 +++++++------- .../src/sdn/fabric/section_config/node.rs | 8 ++++---- proxmox-ve-config/src/sdn/mod.rs | 13 +++++++++---- 17 files changed, 64 insertions(+), 61 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 427837d544e4..5ee6ce989807 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,10 +22,10 @@ anyhow = "1" const_format = "0.2" regex = "1.7" serde = { version = "1" } -serde_with = "3" thiserror = "2.0.0" proxmox-frr = { version = "0.1", path = "proxmox-frr" } proxmox-network-types = { version = "0.1" } proxmox-schema = { version = "4" } proxmox-sdn-types = { version = "0.1", path = "proxmox-sdn-types" } +proxmox-serde = { version = "1.0.0" } diff --git a/proxmox-sdn-types/Cargo.toml b/proxmox-sdn-types/Cargo.toml index 54de2807385a..7d244d2491b9 100644 --- a/proxmox-sdn-types/Cargo.toml +++ b/proxmox-sdn-types/Cargo.toml @@ -12,7 +12,6 @@ rust-version.workspace = true anyhow = { workspace = true } regex = { workspace = true } serde = { workspace = true, features = [ "derive" ] } -serde_with = { workspace = true } proxmox-schema = { workspace = true, features = [ "api-macro", "api-types" ] } -proxmox-serde = { version = "1.0.0", features = [ "perl" ] } +proxmox-serde = { workspace = true, features = [ "perl" ] } diff --git a/proxmox-sdn-types/debian/control b/proxmox-sdn-types/debian/control index bfdb47eb0b55..5bb716e36fec 100644 --- a/proxmox-sdn-types/debian/control +++ b/proxmox-sdn-types/debian/control @@ -7,16 +7,14 @@ Build-Depends-Arch: cargo:native <!nocheck>, rustc:native (>= 1.82) <!nocheck>, libstd-rust-dev <!nocheck>, librust-anyhow-1+default-dev <!nocheck>, - librust-const-format-0.2+default-dev <!nocheck>, librust-proxmox-schema-4+api-macro-dev <!nocheck>, librust-proxmox-schema-4+api-types-dev <!nocheck>, librust-proxmox-schema-4+default-dev <!nocheck>, - librust-proxmox-serde-0.1+default-dev (>= 0.1.2-~~) <!nocheck>, - librust-proxmox-serde-0.1+perl-dev (>= 0.1.2-~~) <!nocheck>, + librust-proxmox-serde-1+default-dev <!nocheck>, + librust-proxmox-serde-1+perl-dev <!nocheck>, librust-regex-1+default-dev (>= 1.7-~~) <!nocheck>, librust-serde-1+default-dev <!nocheck>, - librust-serde-1+derive-dev <!nocheck>, - librust-serde-with-3+default-dev <!nocheck> + librust-serde-1+derive-dev <!nocheck> Maintainer: Proxmox Support Team <supp...@proxmox.com> Standards-Version: 4.7.0 Vcs-Git: git://git.proxmox.com/git/proxmox-ve-rs.git @@ -31,16 +29,14 @@ Multi-Arch: same Depends: ${misc:Depends}, librust-anyhow-1+default-dev, - librust-const-format-0.2+default-dev, librust-proxmox-schema-4+api-macro-dev, librust-proxmox-schema-4+api-types-dev, librust-proxmox-schema-4+default-dev, - librust-proxmox-serde-0.1+default-dev (>= 0.1.2-~~), - librust-proxmox-serde-0.1+perl-dev (>= 0.1.2-~~), + librust-proxmox-serde-1+default-dev, + librust-proxmox-serde-1+perl-dev, librust-regex-1+default-dev (>= 1.7-~~), librust-serde-1+default-dev, - librust-serde-1+derive-dev, - librust-serde-with-3+default-dev + librust-serde-1+derive-dev Provides: librust-proxmox-sdn-types+default-dev (= ${binary:Version}), librust-proxmox-sdn-types-0-dev (= ${binary:Version}), diff --git a/proxmox-sdn-types/src/area.rs b/proxmox-sdn-types/src/area.rs index 71d2d53ba02f..3eba3b1b2545 100644 --- a/proxmox-sdn-types/src/area.rs +++ b/proxmox-sdn-types/src/area.rs @@ -2,21 +2,21 @@ use std::{fmt::Display, net::Ipv4Addr}; use anyhow::Error; use proxmox_schema::{ApiType, Schema, StringSchema, UpdaterType}; -use serde_with::{DeserializeFromStr, SerializeDisplay}; /// An OSPF Area. /// /// Internally the area is just a 32 bit number and is often represented in dotted-decimal /// notation, like an IPv4. FRR also allows us to specify it as a number or an IPv4-Address. /// To keep a nice user experience we keep whichever format the user entered. -#[derive( - Debug, DeserializeFromStr, SerializeDisplay, Clone, Hash, PartialEq, Eq, PartialOrd, Ord, -)] +#[derive(Debug, Clone, Hash, PartialEq, Eq, PartialOrd, Ord)] pub enum Area { Number(u32), IpAddress(Ipv4Addr), } +proxmox_serde::forward_deserialize_to_from_str!(Area); +proxmox_serde::forward_serialize_to_display!(Area); + impl ApiType for Area { const API_SCHEMA: Schema = StringSchema::new("The OSPF area, which can be a number or a ip-address.").schema(); diff --git a/proxmox-ve-config/Cargo.toml b/proxmox-ve-config/Cargo.toml index d5663f953614..ea70f0fa1687 100644 --- a/proxmox-ve-config/Cargo.toml +++ b/proxmox-ve-config/Cargo.toml @@ -17,15 +17,13 @@ tracing = "0.1.37" serde = { workspace = true, features = [ "derive" ] } serde_json = "1" -serde_plain = "1" -serde_with = { workspace = true } -proxmox-serde = { version = "1.0.0", features = [ "perl" ]} proxmox-frr = { workspace = true, optional = true } proxmox-network-types = { workspace = true, features = [ "api-types" ] } proxmox-schema = { workspace = true, features = [ "api-types" ] } proxmox-sdn-types = { workspace = true } proxmox-section-config = { version = "3" } +proxmox-serde = { workspace = true, features = [ "perl" ]} proxmox-sys = "1" proxmox-sortable-macro = "1" diff --git a/proxmox-ve-config/debian/control b/proxmox-ve-config/debian/control index 23daefa92734..3e9f655a0c1b 100644 --- a/proxmox-ve-config/debian/control +++ b/proxmox-ve-config/debian/control @@ -13,7 +13,7 @@ Build-Depends-Arch: cargo:native <!nocheck>, librust-proxmox-network-types-0.1+api-types-dev <!nocheck>, librust-proxmox-network-types-0.1+default-dev <!nocheck>, librust-proxmox-schema-4+api-types-dev <!nocheck>, - librust-proxmox-schema-4+default-dev (>= 4.1-~~) <!nocheck>, + librust-proxmox-schema-4+default-dev <!nocheck>, librust-proxmox-sdn-types-0.1+default-dev <!nocheck>, librust-proxmox-section-config-3+default-dev <!nocheck>, librust-proxmox-serde-1+default-dev <!nocheck>, @@ -24,8 +24,6 @@ Build-Depends-Arch: cargo:native <!nocheck>, librust-serde-1+default-dev <!nocheck>, librust-serde-1+derive-dev <!nocheck>, librust-serde-json-1+default-dev <!nocheck>, - librust-serde-plain-1+default-dev <!nocheck>, - librust-serde-with-3+default-dev <!nocheck>, librust-thiserror-2+default-dev <!nocheck>, librust-tracing-0.1+default-dev (>= 0.1.37-~~) <!nocheck> Maintainer: Proxmox Support Team <supp...@proxmox.com> @@ -47,7 +45,7 @@ Depends: librust-proxmox-network-types-0.1+api-types-dev, librust-proxmox-network-types-0.1+default-dev, librust-proxmox-schema-4+api-types-dev, - librust-proxmox-schema-4+default-dev (>= 4.1-~~), + librust-proxmox-schema-4+default-dev, librust-proxmox-sdn-types-0.1+default-dev, librust-proxmox-section-config-3+default-dev, librust-proxmox-serde-1+default-dev, @@ -58,8 +56,6 @@ Depends: librust-serde-1+default-dev, librust-serde-1+derive-dev, librust-serde-json-1+default-dev, - librust-serde-plain-1+default-dev, - librust-serde-with-3+default-dev, librust-thiserror-2+default-dev, librust-tracing-0.1+default-dev (>= 0.1.37-~~) Suggests: @@ -89,4 +85,3 @@ Provides: Description: Rust crate "proxmox-ve-config" - feature "frr" This metapackage enables feature "frr" for the Rust proxmox-ve-config crate, by pulling in any additional dependencies needed by that feature. - diff --git a/proxmox-ve-config/src/firewall/types/address.rs b/proxmox-ve-config/src/firewall/types/address.rs index 3ed255c5b4e2..89d9b8b8565b 100644 --- a/proxmox-ve-config/src/firewall/types/address.rs +++ b/proxmox-ve-config/src/firewall/types/address.rs @@ -3,7 +3,6 @@ use std::ops::Deref; use anyhow::{bail, Error}; use proxmox_network_types::ip_address::{Cidr, Family, IpRange}; -use serde_with::DeserializeFromStr; #[derive(Clone, Debug)] #[cfg_attr(test, derive(Eq, PartialEq))] @@ -58,7 +57,7 @@ impl From<IpRange> for IpEntry { } } -#[derive(Clone, Debug, DeserializeFromStr)] +#[derive(Clone, Debug)] #[cfg_attr(test, derive(Eq, PartialEq))] pub struct IpList { // guaranteed to have the same family @@ -66,6 +65,8 @@ pub struct IpList { family: Family, } +proxmox_serde::forward_deserialize_to_from_str!(IpList); + impl Deref for IpList { type Target = Vec<IpEntry>; diff --git a/proxmox-ve-config/src/firewall/types/alias.rs b/proxmox-ve-config/src/firewall/types/alias.rs index a463e5231280..c7a58c1ffa44 100644 --- a/proxmox-ve-config/src/firewall/types/alias.rs +++ b/proxmox-ve-config/src/firewall/types/alias.rs @@ -3,7 +3,6 @@ use std::str::FromStr; use anyhow::{bail, format_err, Error}; use proxmox_network_types::ip_address::Cidr; -use serde_with::{DeserializeFromStr, SerializeDisplay}; use crate::firewall::parse::{match_name, match_non_whitespace}; @@ -37,13 +36,16 @@ impl Display for AliasScope { /// Represents the name of an alias in a firewall rule in the RULES section of the firewall /// configuration. -#[derive(Debug, Clone, DeserializeFromStr, SerializeDisplay)] +#[derive(Debug, Clone)] #[cfg_attr(test, derive(Eq, PartialEq))] pub struct AliasName { scope: AliasScope, name: String, } +proxmox_serde::forward_deserialize_to_from_str!(AliasName); +proxmox_serde::forward_serialize_to_display!(AliasName); + impl Display for AliasName { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.write_fmt(format_args!("{}/{}", self.scope, self.name)) diff --git a/proxmox-ve-config/src/firewall/types/ipset.rs b/proxmox-ve-config/src/firewall/types/ipset.rs index 2aaf26152d2c..8a51e38d7c62 100644 --- a/proxmox-ve-config/src/firewall/types/ipset.rs +++ b/proxmox-ve-config/src/firewall/types/ipset.rs @@ -4,7 +4,6 @@ use std::str::FromStr; use anyhow::{bail, format_err, Error}; use proxmox_network_types::ip_address::{Cidr, IpRange}; -use serde_with::DeserializeFromStr; use crate::firewall::parse::match_non_whitespace; use crate::firewall::types::alias::AliasName; @@ -42,13 +41,15 @@ impl Display for IpsetScope { } } -#[derive(Debug, Clone, DeserializeFromStr)] +#[derive(Debug, Clone)] #[cfg_attr(test, derive(Eq, PartialEq))] pub struct IpsetName { pub scope: IpsetScope, pub name: String, } +proxmox_serde::forward_deserialize_to_from_str!(IpsetName); + impl IpsetName { pub fn new(scope: IpsetScope, name: impl Into<String>) -> Self { Self { diff --git a/proxmox-ve-config/src/firewall/types/log.rs b/proxmox-ve-config/src/firewall/types/log.rs index 72344e4c2da5..212650298941 100644 --- a/proxmox-ve-config/src/firewall/types/log.rs +++ b/proxmox-ve-config/src/firewall/types/log.rs @@ -164,7 +164,7 @@ impl fmt::Display for LogLevel { } } -serde_plain::derive_deserialize_from_fromstr!(LogLevel, "valid log level"); +proxmox_serde::forward_deserialize_to_from_str!(LogLevel); #[cfg(test)] mod tests { diff --git a/proxmox-ve-config/src/firewall/types/port.rs b/proxmox-ve-config/src/firewall/types/port.rs index c1252d9e449e..8755516e9db5 100644 --- a/proxmox-ve-config/src/firewall/types/port.rs +++ b/proxmox-ve-config/src/firewall/types/port.rs @@ -2,7 +2,6 @@ use std::fmt; use std::ops::Deref; use anyhow::{bail, Error}; -use serde_with::DeserializeFromStr; use crate::firewall::ports::parse_named_port; @@ -65,10 +64,12 @@ impl TryFrom<(u16, u16)> for PortEntry { } } -#[derive(Clone, Debug, DeserializeFromStr)] +#[derive(Clone, Debug)] #[cfg_attr(test, derive(Eq, PartialEq))] pub struct PortList(pub(crate) Vec<PortEntry>); +proxmox_serde::forward_deserialize_to_from_str!(PortList); + impl FromIterator<PortEntry> for PortList { fn from_iter<T: IntoIterator<Item = PortEntry>>(iter: T) -> Self { Self(iter.into_iter().collect()) diff --git a/proxmox-ve-config/src/firewall/types/rule.rs b/proxmox-ve-config/src/firewall/types/rule.rs index b6b83d2f5557..3ad8cf059f09 100644 --- a/proxmox-ve-config/src/firewall/types/rule.rs +++ b/proxmox-ve-config/src/firewall/types/rule.rs @@ -34,7 +34,7 @@ impl std::str::FromStr for Direction { } } -serde_plain::derive_deserialize_from_fromstr!(Direction, "valid packet direction"); +proxmox_serde::forward_deserialize_to_from_str!(Direction); impl fmt::Display for Direction { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -83,7 +83,7 @@ impl Display for Verdict { } } -serde_plain::derive_deserialize_from_fromstr!(Verdict, "valid verdict"); +proxmox_serde::forward_deserialize_to_from_str!(Verdict); #[derive(Clone, Debug)] #[cfg_attr(test, derive(Eq, PartialEq))] diff --git a/proxmox-ve-config/src/guest/types.rs b/proxmox-ve-config/src/guest/types.rs index ed6a48c672d8..6df138290ffc 100644 --- a/proxmox-ve-config/src/guest/types.rs +++ b/proxmox-ve-config/src/guest/types.rs @@ -2,13 +2,13 @@ use std::fmt; use std::str::FromStr; use anyhow::{format_err, Error}; -use serde_with::{DeserializeFromStr, SerializeDisplay}; -#[derive( - Clone, Copy, Debug, Eq, PartialEq, PartialOrd, Ord, Hash, SerializeDisplay, DeserializeFromStr, -)] +#[derive(Clone, Copy, Debug, Eq, PartialEq, PartialOrd, Ord, Hash)] pub struct Vmid(u32); +proxmox_serde::forward_deserialize_to_from_str!(Vmid); +proxmox_serde::forward_serialize_to_display!(Vmid); + impl Vmid { pub fn new(id: u32) -> Self { Vmid(id) diff --git a/proxmox-ve-config/src/guest/vm.rs b/proxmox-ve-config/src/guest/vm.rs index 34b9075db317..cc977818b01d 100644 --- a/proxmox-ve-config/src/guest/vm.rs +++ b/proxmox-ve-config/src/guest/vm.rs @@ -4,7 +4,6 @@ use std::str::FromStr; use anyhow::{bail, Error}; use serde::Deserialize; -use serde_with::DeserializeFromStr; use proxmox_network_types::ip_address::{Ipv4Cidr, Ipv6Cidr}; use proxmox_network_types::mac_address::MacAddress; @@ -15,7 +14,7 @@ use proxmox_sortable_macro::sortable; use crate::firewall::parse::match_digits; /// All possible models of network devices for both QEMU and LXC guests. -#[derive(Debug, Clone, Copy, DeserializeFromStr)] +#[derive(Debug, Clone, Copy)] #[cfg_attr(test, derive(Eq, PartialEq))] pub enum NetworkDeviceModel { VirtIO, @@ -25,6 +24,8 @@ pub enum NetworkDeviceModel { RTL8139, } +proxmox_serde::forward_deserialize_to_from_str!(NetworkDeviceModel); + impl FromStr for NetworkDeviceModel { type Err = Error; @@ -85,7 +86,7 @@ impl ApiType for QemuNetworkDevice { } /// Representation of possible values for an LXC guest IPv4 field. -#[derive(Debug, DeserializeFromStr, Copy, Clone)] +#[derive(Debug, Copy, Clone)] #[cfg_attr(test, derive(Eq, PartialEq))] pub enum LxcIpv4Addr { Ip(Ipv4Cidr), @@ -93,6 +94,8 @@ pub enum LxcIpv4Addr { Manual, } +proxmox_serde::forward_deserialize_to_from_str!(LxcIpv4Addr); + impl LxcIpv4Addr { pub fn cidr(&self) -> Option<Ipv4Cidr> { match self { @@ -115,7 +118,7 @@ impl FromStr for LxcIpv4Addr { } /// Representation of possible values for an LXC guest IPv6 field. -#[derive(Debug, DeserializeFromStr, Copy, Clone)] +#[derive(Debug, Copy, Clone)] #[cfg_attr(test, derive(Eq, PartialEq))] pub enum LxcIpv6Addr { Ip(Ipv6Cidr), @@ -124,6 +127,8 @@ pub enum LxcIpv6Addr { Manual, } +proxmox_serde::forward_deserialize_to_from_str!(LxcIpv6Addr); + impl LxcIpv6Addr { pub fn cidr(&self) -> Option<Ipv6Cidr> { match self { diff --git a/proxmox-ve-config/src/sdn/config.rs b/proxmox-ve-config/src/sdn/config.rs index 898121c01332..031fedcebbfc 100644 --- a/proxmox-ve-config/src/sdn/config.rs +++ b/proxmox-ve-config/src/sdn/config.rs @@ -9,7 +9,6 @@ use std::{ use proxmox_network_types::ip_address::{Cidr, IpRange, IpRangeError}; use proxmox_schema::{property_string::PropertyString, ApiType, ObjectSchema, StringSchema}; use serde::Deserialize; -use serde_with::{DeserializeFromStr, SerializeDisplay}; use crate::{ common::Allowlist, @@ -63,9 +62,7 @@ impl Display for SdnConfigError { } } -#[derive( - Copy, Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, SerializeDisplay, DeserializeFromStr, -)] +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)] pub enum ZoneType { Simple, Vlan, @@ -74,6 +71,9 @@ pub enum ZoneType { Evpn, } +proxmox_serde::forward_deserialize_to_from_str!(ZoneType); +proxmox_serde::forward_serialize_to_display!(ZoneType); + impl FromStr for ZoneType { type Err = SdnConfigError; @@ -101,12 +101,12 @@ impl Display for ZoneType { } } -#[derive( - Copy, Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, SerializeDisplay, DeserializeFromStr, -)] +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)] pub enum DhcpType { Dnsmasq, } +proxmox_serde::forward_deserialize_to_from_str!(DhcpType); +proxmox_serde::forward_serialize_to_display!(DhcpType); impl FromStr for DhcpType { type Err = SdnConfigError; diff --git a/proxmox-ve-config/src/sdn/fabric/section_config/node.rs b/proxmox-ve-config/src/sdn/fabric/section_config/node.rs index b8a14d2268a0..17d2f0b8de8a 100644 --- a/proxmox-ve-config/src/sdn/fabric/section_config/node.rs +++ b/proxmox-ve-config/src/sdn/fabric/section_config/node.rs @@ -1,7 +1,6 @@ use const_format::concatcp; use proxmox_schema::api_types::{IP_V4_SCHEMA, IP_V6_SCHEMA}; use serde::{Deserialize, Serialize}; -use serde_with::{DeserializeFromStr, SerializeDisplay}; use proxmox_network_types::ip_address::api_types::{Ipv4Addr, Ipv6Addr}; @@ -44,14 +43,15 @@ api_string_type! { /// /// This struct is a helper for parsing the string into the two separate parts. It (de-)serializes /// from and into a String. -#[derive( - Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, SerializeDisplay, DeserializeFromStr, -)] +#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct NodeSectionId { pub(crate) fabric_id: FabricId, pub(crate) node_id: NodeId, } +proxmox_serde::forward_deserialize_to_from_str!(NodeSectionId); +proxmox_serde::forward_serialize_to_display!(NodeSectionId); + impl ApiType for NodeSectionId { const API_SCHEMA: Schema = StringSchema::new("ID of a SDN node in the section config") .format(&NODE_SECTION_ID_FORMAT) diff --git a/proxmox-ve-config/src/sdn/mod.rs b/proxmox-ve-config/src/sdn/mod.rs index 6252601f507e..4586c56358ef 100644 --- a/proxmox-ve-config/src/sdn/mod.rs +++ b/proxmox-ve-config/src/sdn/mod.rs @@ -7,7 +7,6 @@ pub mod ipam; use std::{error::Error, fmt::Display, str::FromStr}; use proxmox_network_types::ip_address::Cidr; -use serde_with::DeserializeFromStr; #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)] pub enum SdnNameError { @@ -54,9 +53,11 @@ fn validate_sdn_name(name: &str) -> Result<(), SdnNameError> { } /// represents the name of an sdn zone -#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, DeserializeFromStr)] +#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)] pub struct ZoneName(String); +proxmox_serde::forward_deserialize_to_from_str!(ZoneName); + impl ZoneName { /// construct a new zone name /// @@ -91,9 +92,11 @@ impl Display for ZoneName { } /// represents the name of an sdn vnet -#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, DeserializeFromStr)] +#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)] pub struct VnetName(String); +proxmox_serde::forward_deserialize_to_from_str!(VnetName); + impl VnetName { /// construct a new vnet name /// @@ -135,9 +138,11 @@ impl Display for VnetName { /// /// # Textual representation /// A subnet name has the form `{zone_id}-{cidr_ip}-{cidr_mask}` -#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, DeserializeFromStr)] +#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)] pub struct SubnetName(ZoneName, Cidr); +proxmox_serde::forward_deserialize_to_from_str!(SubnetName); + impl SubnetName { pub fn new(zone: ZoneName, cidr: Cidr) -> Self { SubnetName(zone, cidr) -- 2.39.5 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel