1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
cfg_if::cfg_if! {
    if #[cfg(feature = "tokio")] {
       pub(crate) use tokio_crate::fs::{self, File};
    } else if #[cfg(feature = "async-std")] {
        pub(crate) use async_std_crate::fs::{self, File};
    } else if #[cfg(feature = "smol")] {
        pub(crate) use async_fs::{self as fs, File};
    } else {
        #[derive(Debug, Clone, Copy)]
        pub struct File;
        impl File {
            pub(crate) async fn open(_path: impl AsRef<std::path::Path>) -> std::io::Result<Self> {
                unimplemented!("please enable the tokio, async-std, or smol runtime feature")
            }

            pub(crate) async fn metadata(&self) -> std::io::Result<std::fs::Metadata> {
                unimplemented!("please enable the tokio, async-std, or smol runtime feature")
            }
        }

        impl futures_lite::AsyncRead for File {
            fn poll_read(
                self: std::pin::Pin<&mut Self>,
                _cx: &mut std::task::Context<'_>,
                _buf: &mut [u8],
            ) -> std::task::Poll<std::io::Result<usize>> {
                unimplemented!("please enable the tokio, async-std, or smol runtime feature")

            }
        }



        pub(crate) mod fs {
            pub(crate) async fn canonicalize(_path: impl AsRef<std::path::Path>) -> std::io::Result<std::path::PathBuf> {
                unimplemented!("please enable the tokio, async-std, or smol runtime feature")
            }

            pub(crate) async fn metadata(_path: impl AsRef<std::path::Path>) -> std::io::Result<std::fs::Metadata> {
                unimplemented!("please enable the tokio, async-std, or smol runtime feature")
            }
        }
    }
}