kutil_http/file/
response.rs

1use {http::*, std::path::Path, tower::*, tower_http::services::fs::*};
2
3/// Serve file.
4pub async fn response_from_file<PathT>(path: PathT) -> Response<ServeFileSystemResponseBody>
5where
6    PathT: AsRef<Path>,
7{
8    ServeFile::new(path).oneshot(Request::new(())).await.expect("infallible")
9}