From 2ba96cc9cb6a70ef9e1ecb86af45100ba4e1bfb4 Mon Sep 17 00:00:00 2001 From: Ben Grant Date: Mon, 15 May 2023 18:33:32 +1000 Subject: [PATCH] Setup features for conditional compilation --- backend/Cargo.toml | 4 ++++ backend/src/adaptors.rs | 2 ++ 2 files changed, 6 insertions(+) diff --git a/backend/Cargo.toml b/backend/Cargo.toml index e0da7b4..2d55a2a 100644 --- a/backend/Cargo.toml +++ b/backend/Cargo.toml @@ -5,6 +5,10 @@ license = "GPL-3.0-only" version = "2.0.0" edition = "2021" +[features] +sql-adaptor = [] +datastore-adaptor = [] + [workspace] members = ["common", "adaptors/*"] diff --git a/backend/src/adaptors.rs b/backend/src/adaptors.rs index 95d280b..2010922 100644 --- a/backend/src/adaptors.rs +++ b/backend/src/adaptors.rs @@ -8,6 +8,8 @@ pub async fn create_adaptor() -> datastore_adaptor::DatastoreAdaptor { datastore_adaptor::DatastoreAdaptor::new().await } +#[cfg(not(feature = "sql-adaptor"))] +#[cfg(not(feature = "datastore-adaptor"))] pub async fn create_adaptor() -> memory_adaptor::MemoryAdaptor { memory_adaptor::MemoryAdaptor::new().await }