summaryrefslogtreecommitdiffstats
path: root/src/source.rs
diff options
context:
space:
mode:
authorNicolas Stinus <nicolas.stinus@gmail.com>2022-12-05 16:10:23 -0500
committerNicolas Stinus <nicolas.stinus@gmail.com>2022-12-05 16:10:23 -0500
commit5a9f666a55ebb769e45e2b8a8477909a57855170 (patch)
treee38f2b24329e8d5e6ed3227acba24d24ba67c0b4 /src/source.rs
parent74bdf5e766450c7c93f9121951d72b23f2b6b14d (diff)
Gate async-traits behind a feature
Diffstat (limited to 'src/source.rs')
-rw-r--r--src/source.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/source.rs b/src/source.rs
index 94f1c35..16e1938 100644
--- a/src/source.rs
+++ b/src/source.rs
@@ -1,6 +1,7 @@
use std::fmt::Debug;
use std::str::FromStr;
+#[cfg(feature = "async")]
use async_trait::async_trait;
use crate::error::Result;
@@ -50,6 +51,7 @@ fn set_value(cache: &mut Value, key: &str, value: &Value) {
/// It is advised to use `async_trait` crate while implementing this trait.
///
/// See examples for sample implementation.
+#[cfg(feature = "async")]
#[async_trait]
pub trait AsyncSource: Debug + Sync {
// Sync is supertrait due to https://docs.rs/async-trait/0.1.50/async_trait/index.html#dyn-traits
@@ -69,6 +71,7 @@ pub trait AsyncSource: Debug + Sync {
}
}
+#[cfg(feature = "async")]
impl Clone for Box<dyn AsyncSource + Send + Sync> {
fn clone(&self) -> Self {
self.to_owned()