From 8170a1d778a3879c7601b3b7e1aa56b91504f877 Mon Sep 17 00:00:00 2001 From: Chris Tsang Date: Sun, 15 Aug 2021 16:40:47 +0800 Subject: [PATCH] #105 Use Arc under `thread-safe` --- Cargo.toml | 1 + src/types.rs | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 0dc9f4a7b..582f16be2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -60,6 +60,7 @@ rusqlite = [] sqlx-mysql = [] sqlx-postgres = [] sqlx-sqlite = [] +thread-safe = [] with-chrono = ["chrono"] with-json = ["serde_json"] with-rust_decimal = ["rust_decimal"] diff --git a/src/types.rs b/src/types.rs index d1b4a9175..0464cafa7 100644 --- a/src/types.rs +++ b/src/types.rs @@ -2,7 +2,11 @@ use crate::{expr::*, query::*}; use std::fmt; -pub use std::rc::Rc as SeaRc; // in case we some day we want to use Arc instead of Rc + +#[cfg(feature = "thread-safe")] +pub use std::sync::Arc as SeaRc; +#[cfg(not(feature = "thread-safe"))] +pub use std::rc::Rc as SeaRc; /// Identifier in query pub trait Iden {