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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
use std::io;
use crate::channel;
use crate::fuse_server;
use crate::server;
#[cfg_attr(doc, doc(cfg(feature = "std")))]
pub struct DevFuseChannel(channel::FileChannel);
impl DevFuseChannel {
#[cfg(any(
feature = "libc_fuse_mount",
feature = "nightly_syscall_fuse_mount",
))]
pub(super) fn new(file: std::fs::File) -> DevFuseChannel {
Self(channel::FileChannel::new(file))
}
}
#[cfg(not(feature = "nightly_impl_channel"))]
impl channel::private::ChannelNoConstGenerics<io::Error> for DevFuseChannel {
fn send_vectored_2(&self, bufs: &[&[u8]; 2]) -> Result<(), io::Error> {
self.0.send_vectored_2(bufs)
}
fn send_vectored_3(&self, bufs: &[&[u8]; 3]) -> Result<(), io::Error> {
self.0.send_vectored_3(bufs)
}
fn send_vectored_5(&self, bufs: &[&[u8]; 5]) -> Result<(), io::Error> {
self.0.send_vectored_5(bufs)
}
}
impl channel::Channel for DevFuseChannel {
type Error = io::Error;
fn send(&self, buf: &[u8]) -> Result<(), io::Error> {
self.0.send(buf)
}
#[cfg(any(doc, feature = "nightly_impl_channel"))]
fn send_vectored<const N: usize>(
&self,
bufs: &[&[u8]; N],
) -> Result<(), io::Error> {
self.0.send_vectored(bufs)
}
fn receive(&self, buf: &mut [u8]) -> Result<usize, io::Error> {
self.0.receive(buf)
}
}
impl server::ServerChannel for DevFuseChannel {
fn try_clone(&self) -> Result<Self, io::Error> {
Ok(DevFuseChannel(self.0.try_clone()?))
}
}
impl fuse_server::FuseServerChannel for DevFuseChannel {}