/// returns a result contains file body from dist directory or just an error of
/// not found.
returns a result contains file body from dist directory or just an error of
not found.
returns a result contains file body from dist directory or just an error of not found .
async fn send_file(name: &str) -> Result<Response<Body>> {
    let path = Path::new(DST_DIR).join(name);
    if let Ok(file) = File::open(path).await {
        let stream = FramedRead::new(file, BytesCodec::new());
        let body = Body::wrap_stream(stream);
        return Ok(Response::new(body));
    }
    not_found()
}
async fn send_file ( name : & str ) -> Result < Response < Body > > { let path = Path :: new ( DST_DIR ) . join ( name ) ; if let Ok ( file ) = File :: open ( path ) . await { let stream = FramedRead :: new ( file , BytesCodec :: new ( ) ) ; let body = Body :: wrap_stream ( stream ) ; return Ok ( Response :: new ( body ) ) ; } not_found ( ) }
returns a result contains file body from dist directory or just an error of
not found.
returns a result contains file body from dist directory or just an error of not found .
name
&str