Handler

Trait Handler 

Source
pub trait Handler: Send {
    type Reader: AsyncRead + Unpin + Send + 'static;
    type Writer: AsyncWrite + Unpin + Send + 'static;

    // Required methods
    fn read_req_open(
        &mut self,
        client: &SocketAddr,
        path: &Path,
    ) -> impl Future<Output = Result<(Self::Reader, Option<u64>), Error>> + Send;
    fn write_req_open(
        &mut self,
        client: &SocketAddr,
        path: &Path,
        size: Option<u64>,
    ) -> impl Future<Output = Result<Self::Writer, Error>> + Send;
}
Expand description

Trait for implementing advance handlers.

Required Associated Types§

Source

type Reader: AsyncRead + Unpin + Send + 'static

Source

type Writer: AsyncWrite + Unpin + Send + 'static

Required Methods§

Source

fn read_req_open( &mut self, client: &SocketAddr, path: &Path, ) -> impl Future<Output = Result<(Self::Reader, Option<u64>), Error>> + Send

Open Reader to serve a read request.

Source

fn write_req_open( &mut self, client: &SocketAddr, path: &Path, size: Option<u64>, ) -> impl Future<Output = Result<Self::Writer, Error>> + Send

Open Writer to serve a write request.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§