diff --git a/src/jsonrpc.rs b/src/jsonrpc.rs index 223d003..b52348b 100644 --- a/src/jsonrpc.rs +++ b/src/jsonrpc.rs @@ -21,7 +21,7 @@ mod response; mod router; /// A unique ID used to correlate requests and responses together. -#[derive(Clone, Debug, Eq, Hash, PartialEq, Deserialize, Serialize)] +#[derive(Default, Clone, Debug, Eq, Hash, PartialEq, Deserialize, Serialize)] #[serde(untagged)] pub enum Id { /// Numeric ID. @@ -33,15 +33,10 @@ pub enum Id { /// While `null` is considered a valid request ID by the JSON-RPC 2.0 specification, its use is /// _strongly_ discouraged because the specification also uses a `null` value to indicate an /// unknown ID in the [`Response`] object. + #[default] Null, } -impl Default for Id { - fn default() -> Self { - Id::Null - } -} - impl Display for Id { fn fmt(&self, f: &mut Formatter) -> fmt::Result { match self {