Explain Serde derives on backend driver enums

This commit is contained in:
2026-11-30 17:19:28 +08:00
parent 7982fffcda
commit 51beaafc4c
2 changed files with 8 additions and 2 deletions
+6 -2
View File
@@ -2,12 +2,15 @@ use serde::{Deserialize, Serialize};
use crate::SqlDriver;
/// Backend taxonomy. Configuration currently enables SQL and object storage.
/// Common backend type for catalog lookups in Rust.
///
/// Serialized configuration uses category-specific driver types in its fields.
/// Deriving Serde traits on this enum would also require them on every wrapped type.
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum Driver {
Sql(SqlDriver),
ObjectStore(ObjectStoreDriver),
// Reserved for future adapters.
// Reserved categories gain Serde traits when their configuration fields are added.
Cache(CacheDriver),
Search(SearchDriver),
EventStream(EventStreamDriver),
@@ -15,6 +18,7 @@ pub enum Driver {
OnlineService(OnlineServiceKind),
}
/// The driver in object storage configuration. Serde reads and writes `S3` as `s3`.
#[derive(Clone, Copy, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum ObjectStoreDriver {
+2
View File
@@ -5,6 +5,8 @@ use url::Url;
use crate::ConfigError;
/// The driver in SQL cluster configuration. Serde uses snake_case names such as `postgres`.
/// `SqlDriver::default()` selects `Sqlite`.
#[derive(Clone, Copy, Debug, Default, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum SqlDriver {