diff --git a/src/stmt.rs b/src/stmt.rs index 5382224..ffc5243 100644 --- a/src/stmt.rs +++ b/src/stmt.rs @@ -33,10 +33,8 @@ pub enum Statement { /// anonymous or named counter. Counter(Counter), Mangle(Mangle), - Quota(Quota), - #[serde(rename = "quota")] - /// reference to a named quota object - QuotaRef(String), + /// anonymous or named quota. + Quota(QuotaOrQuotaRef), // TODO: last Limit(Limit), @@ -155,6 +153,16 @@ pub struct Mangle { pub value: Expression, } +#[derive(Debug, Clone, Eq, PartialEq, Serialize, Deserialize)] +#[serde(untagged)] +/// Represents an anonymous or named quota object. +pub enum QuotaOrQuotaRef { + /// Anonymous quota object. + Quota(Quota), + /// Reference to a named quota object. + QuotaRef(String), +} + #[derive(Debug, Clone, Eq, PartialEq, Serialize, Deserialize)] /// Creates an anonymous quota which lives in the rule it appears in. pub struct Quota {