#[cfg(all(target_os = "android", target_arch = "arm"))]
pub mod android;
#[cfg(not(target_arch = "wasm32"))]
pub(crate) mod blocking;
#[cfg(any(target_os = "macos", target_os = "ios"))]
pub mod gcd;
#[cfg(target_os = "windows")]
pub mod iocp;
#[cfg(any(
target_os = "linux",
all(target_os = "android", not(target_arch = "arm")),
))]
pub mod iouring;
pub mod memory;
#[cfg(feature = "opfs")]
pub mod opfs;
#[cfg(not(target_arch = "wasm32"))]
pub mod tokio_backend;
pub(crate) mod traits;
pub(crate) mod types;
pub mod wasi;
#[cfg(all(target_os = "android", target_arch = "arm"))]
pub use android::AndroidVfs;
#[cfg(any(target_os = "macos", target_os = "ios"))]
pub use gcd::GcdVfs;
#[cfg(target_os = "windows")]
pub use iocp::{IocpFile, IocpVfs};
#[cfg(any(
target_os = "linux",
all(target_os = "android", not(target_arch = "arm")),
))]
pub use iouring::{IouringFile, IouringVfs};
#[cfg(feature = "opfs")]
pub use opfs::OpfsVfs;
pub use traits::{Vfs, VfsFile};
pub(crate) use traits::{
checked_read_progress, read_exact_at, read_exact_at_borrowed, write_all_at,
};
pub use types::{OpenMode, ReadReq, WriteReq};
pub use wasi::WasiVfs;
#[cfg(any(
target_os = "linux",
all(target_os = "android", not(target_arch = "arm")),
))]
pub type DefaultVfs = IouringVfs;
#[cfg(target_os = "windows")]
pub type DefaultVfs = IocpVfs;
#[cfg(any(target_os = "macos", target_os = "ios"))]
pub type DefaultVfs = GcdVfs;
#[cfg(all(target_os = "android", target_arch = "arm"))]
pub type DefaultVfs = AndroidVfs;
#[cfg(all(
not(target_arch = "wasm32"),
not(target_os = "linux"),
not(target_os = "windows"),
not(target_os = "macos"),
not(target_os = "ios"),
not(target_os = "android"),
))]
pub type DefaultVfs = tokio_backend::TokioVfs;
#[cfg(not(target_arch = "wasm32"))]
pub fn open_default<P: AsRef<std::path::Path>>(path: P) -> crate::Result<DefaultVfs> {
#[cfg(any(
all(target_os = "linux", not(target_arch = "wasm32")),
all(target_os = "android", not(target_arch = "arm")),
))]
{
IouringVfs::new(path.as_ref())
}
#[cfg(target_os = "windows")]
{
IocpVfs::new(path.as_ref())
}
#[cfg(any(target_os = "macos", target_os = "ios"))]
{
Ok(GcdVfs::new(path.as_ref()))
}
#[cfg(all(target_os = "android", target_arch = "arm"))]
{
Ok(AndroidVfs::new(path.as_ref()))
}
#[cfg(all(
not(target_os = "linux"),
not(target_os = "windows"),
not(target_os = "macos"),
not(target_os = "ios"),
not(target_os = "android"),
))]
{
Ok(tokio_backend::TokioVfs::new(path.as_ref()))
}
}