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
use futures::AsyncRead;
#[cfg(feature = "unstable")]
use futures::AsyncWrite;
use std::net::SocketAddr;
use std::path::Path;
use crate::packet;
#[crate::async_trait]
pub trait Handler: Send {
type Reader: AsyncRead + Unpin + Send + 'static;
#[cfg(feature = "unstable")]
type Writer: AsyncWrite + Unpin + Send + 'static;
async fn read_req_open(
&mut self,
client: &SocketAddr,
path: &Path,
) -> Result<(Self::Reader, Option<u64>), packet::Error>;
#[cfg(feature = "unstable")]
async fn read_req_served(
&mut self,
_client: &SocketAddr,
_path: &Path,
_reader: Self::Reader,
) {
}
#[cfg(feature = "unstable")]
async fn write_open(
&mut self,
client: &SocketAddr,
path: &Path,
size: Option<u64>,
) -> Result<Self::Writer, packet::Error>;
}