mirror of
https://github.com/denoland/deno.git
synced 2025-08-04 02:48:24 +00:00
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.
This commit is contained in:
parent
0aa2d7c9c1
commit
df1ca4a158
12 changed files with 134 additions and 94 deletions
|
@ -11,6 +11,9 @@ use deno_io::fs::File;
|
|||
use deno_io::fs::FsResult;
|
||||
use deno_io::fs::FsStat;
|
||||
|
||||
use crate::sync::MaybeSend;
|
||||
use crate::sync::MaybeSync;
|
||||
|
||||
#[derive(Deserialize, Default, Debug, Clone, Copy)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[serde(default)]
|
||||
|
@ -72,8 +75,11 @@ pub struct FsDirEntry {
|
|||
pub is_symlink: bool,
|
||||
}
|
||||
|
||||
#[allow(clippy::disallowed_types)]
|
||||
pub type FileSystemRc = crate::sync::MaybeArc<dyn FileSystem>;
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
pub trait FileSystem: std::fmt::Debug + Send + Sync {
|
||||
pub trait FileSystem: std::fmt::Debug + MaybeSend + MaybeSync {
|
||||
fn cwd(&self) -> FsResult<PathBuf>;
|
||||
fn tmp_dir(&self) -> FsResult<PathBuf>;
|
||||
fn chdir(&self, path: &Path) -> FsResult<()>;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue