diff options
| author | David Sherret <dsherret@users.noreply.github.com> | 2023-05-08 11:02:02 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-05-08 11:02:02 -0400 |
| commit | df1ca4a158eda08846e11ceb03dd68d6fcffda75 (patch) | |
| tree | a2c3f2922a3b6326d223e079e3acbedb95048918 /ext/fs/sync.rs | |
| parent | 0aa2d7c9c16c514e47bbd07ca90552f9159901ef (diff) | |
refactor(ext/fs): `deno_fs::FileSystem` - conditional `Send + Sync` (#18993)
This allows for having a conditional `Send + Sync` on the file system trait for Deploy.
Diffstat (limited to 'ext/fs/sync.rs')
| -rw-r--r-- | ext/fs/sync.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/ext/fs/sync.rs b/ext/fs/sync.rs new file mode 100644 index 000000000..c43850c28 --- /dev/null +++ b/ext/fs/sync.rs @@ -0,0 +1,22 @@ +// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. + +pub use inner::*; + +#[cfg(feature = "sync_fs")] +mod inner { + #![allow(clippy::disallowed_types)] + pub use std::sync::Arc as MaybeArc; + + pub use core::marker::Send as MaybeSend; + pub use core::marker::Sync as MaybeSync; +} + +#[cfg(not(feature = "sync_fs"))] +mod inner { + pub use std::rc::Rc as MaybeArc; + + pub trait MaybeSync {} + impl<T> MaybeSync for T where T: ?Sized {} + pub trait MaybeSend {} + impl<T> MaybeSend for T where T: ?Sized {} +} |
