async_tftp/server/
handler.rs1use futures_lite::{AsyncRead, AsyncWrite};
2use std::future::Future;
3use std::net::SocketAddr;
4use std::path::Path;
5
6use crate::packet;
7
8pub trait Handler: Send {
10    type Reader: AsyncRead + Unpin + Send + 'static;
11    type Writer: AsyncWrite + Unpin + Send + 'static;
12
13    fn read_req_open(
15        &mut self,
16        client: &SocketAddr,
17        path: &Path,
18    ) -> impl Future<Output = Result<(Self::Reader, Option<u64>), packet::Error>>
19           + Send;
20
21    fn write_req_open(
23        &mut self,
24        client: &SocketAddr,
25        path: &Path,
26        size: Option<u64>,
27    ) -> impl Future<Output = Result<Self::Writer, packet::Error>> + Send;
28}