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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
use cap_primitives::fs::is_file_read_write;
use io_lifetimes::AsFilelike;
use std::io;
pub trait IsFileReadWrite {
fn is_file_read_write(&self) -> io::Result<(bool, bool)>;
}
impl IsFileReadWrite for std::fs::File {
#[inline]
fn is_file_read_write(&self) -> io::Result<(bool, bool)> {
is_file_read_write(self)
}
}
#[cfg(all(feature = "std"))]
impl IsFileReadWrite for cap_std::fs::File {
#[inline]
fn is_file_read_write(&self) -> io::Result<(bool, bool)> {
is_file_read_write(&self.as_filelike_view::<std::fs::File>())
}
}
#[cfg(all(feature = "std", feature = "fs_utf8"))]
impl IsFileReadWrite for cap_std::fs_utf8::File {
#[inline]
fn is_file_read_write(&self) -> io::Result<(bool, bool)> {
is_file_read_write(&self.as_filelike_view::<std::fs::File>())
}
}
#[cfg(all(feature = "async_std"))]
impl IsFileReadWrite for async_std::fs::File {
#[inline]
fn is_file_read_write(&self) -> io::Result<(bool, bool)> {
is_file_read_write(&self.as_filelike_view::<std::fs::File>())
}
}
#[cfg(all(feature = "async_std"))]
impl IsFileReadWrite for cap_async_std::fs::File {
#[inline]
fn is_file_read_write(&self) -> io::Result<(bool, bool)> {
is_file_read_write(&self.as_filelike_view::<std::fs::File>())
}
}
#[cfg(all(feature = "async_std", feature = "fs_utf8"))]
impl IsFileReadWrite for cap_async_std::fs_utf8::File {
#[inline]
fn is_file_read_write(&self) -> io::Result<(bool, bool)> {
is_file_read_write(&self.as_filelike_view::<std::fs::File>())
}
}