Explain Serde derives on backend driver enums
This commit is contained in:
@@ -2,12 +2,15 @@ use serde::{Deserialize, Serialize};
|
|||||||
|
|
||||||
use crate::SqlDriver;
|
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)]
|
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||||
pub enum Driver {
|
pub enum Driver {
|
||||||
Sql(SqlDriver),
|
Sql(SqlDriver),
|
||||||
ObjectStore(ObjectStoreDriver),
|
ObjectStore(ObjectStoreDriver),
|
||||||
// Reserved for future adapters.
|
// Reserved categories gain Serde traits when their configuration fields are added.
|
||||||
Cache(CacheDriver),
|
Cache(CacheDriver),
|
||||||
Search(SearchDriver),
|
Search(SearchDriver),
|
||||||
EventStream(EventStreamDriver),
|
EventStream(EventStreamDriver),
|
||||||
@@ -15,6 +18,7 @@ pub enum Driver {
|
|||||||
OnlineService(OnlineServiceKind),
|
OnlineService(OnlineServiceKind),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// The driver in object storage configuration. Serde reads and writes `S3` as `s3`.
|
||||||
#[derive(Clone, Copy, Debug, Deserialize, Serialize, Eq, PartialEq)]
|
#[derive(Clone, Copy, Debug, Deserialize, Serialize, Eq, PartialEq)]
|
||||||
#[serde(rename_all = "snake_case")]
|
#[serde(rename_all = "snake_case")]
|
||||||
pub enum ObjectStoreDriver {
|
pub enum ObjectStoreDriver {
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ use url::Url;
|
|||||||
|
|
||||||
use crate::ConfigError;
|
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)]
|
#[derive(Clone, Copy, Debug, Default, Deserialize, Serialize, Eq, PartialEq)]
|
||||||
#[serde(rename_all = "snake_case")]
|
#[serde(rename_all = "snake_case")]
|
||||||
pub enum SqlDriver {
|
pub enum SqlDriver {
|
||||||
|
|||||||
Reference in New Issue
Block a user