Feature lock Shared, so backend feature gets a facade type

This commit is contained in:
Quat3rnion 2024-06-03 23:56:17 -04:00
parent 179b8d228a
commit 40bdafd1a3
2 changed files with 4 additions and 0 deletions

View File

@ -134,6 +134,7 @@ pub trait IntoShared {
fn into_shared(self) -> Shared<Self>;
}
#[cfg(feature = "client")]
impl<T: Sized> IntoShared for T {
fn into_shared(self) -> Shared<Self> {
Arc::new(RwLock::new(self))

View File

@ -28,4 +28,7 @@ mod utils;
///
/// While `T` does not have to implement `Composite` to be used with `Shared`,
/// the primary use of `Shared` is with types that implement `Composite`.
#[cfg(feature = "client")]
pub type Shared<T> = Arc<RwLock<T>>;
#[cfg(not(feature = "client"))]
pub type Shared<T> = T;